diff options
| -rw-r--r-- | map.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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; |
