From dd5d7ac0430f0663a03955c0ff677da27745b498 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Fri, 24 Apr 2026 17:04:44 +0300 Subject: Add wraparound keybinding in map_editor() --- map.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'map.c') diff --git a/map.c b/map.c index b067475..6f89b19 100644 --- a/map.c +++ b/map.c @@ -660,6 +660,8 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi * [d] - Switch algorithms (A* or Dijsktra's) * [4] - Switch amount of directions (4 or 8) * + * [f] - Toggle wraparound + * * [r] - Reverse path * * [s] - Save the map to a plaintext file @@ -732,6 +734,19 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi if (should_pathfind) path = path_func(dirs, *map, NULL, *width, *height, *start, *goal, visited, 0); break; + case 'f': + wraparound_enabled = !wraparound_enabled; + if (wraparound_enabled) + set_message("Enabled wraparound, only works on Dijkstra's") + else + set_message("Disabled wraparound"); + + if (path_func == dijkstra_path && should_pathfind) { + path_free(path, *height); + path = path_func(dirs, *map, NULL, *width, *height, *start, *goal, visited, 0); + } + break; + case 'r': path_reverse(&path, *width, *height, start, goal); break; -- cgit v1.2.3