diff options
Diffstat (limited to 'path.c')
| -rw-r--r-- | path.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -16,6 +16,8 @@ Path (*path_func)(int, Map, size_t **, size_t, size_t, Position, Position, char **, char) = &astar_path; double path_time = 0; +char wraparound_enabled = 0; + char anim_automatic = 0; /* TODO: make it move the map maybe to show the path */ @@ -134,8 +136,12 @@ Path dijkstra_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t unsigned int (*neighbours)(Position[], size_t[], Position, size_t, size_t, char**, size_t**) = NULL; switch (dirs) { - case 4: neighbours = &neighbours_4dir; break; - case 8: neighbours = &neighbours_8dir; break; + case 4: if (wraparound_enabled) neighbours = &neighbours_4dir_wraparound; + else neighbours = &neighbours_4dir; + break; + case 8: if (wraparound_enabled) neighbours = &neighbours_8dir_wraparound; + else neighbours = &neighbours_8dir; + break; default: error("Tried to call dijkstra_path with wrong direction amount\n"); } |
