From 6834ffa31842ca249514854bac8bae0f0022f104 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Thu, 23 Apr 2026 14:29:15 +0300 Subject: Make wraparound toggleable with a keybind --- path.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'path.c') diff --git a/path.c b/path.c index 15c7e31..450ea91 100644 --- a/path.c +++ b/path.c @@ -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"); } -- cgit v1.2.3