aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-24 17:08:25 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-24 17:08:25 +0300
commit5b2d190819d043639be4b747c660f549f03987d7 (patch)
treebcbd10d2c0d52cac152edaaf5fe01d6e3d87a6c5
parentdd5d7ac0430f0663a03955c0ff677da27745b498 (diff)
downloadastar-5b2d190819d043639be4b747c660f549f03987d7.tar.xz
Add ability to clear the map in map_editor()
-rw-r--r--map.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/map.c b/map.c
index 6f89b19..73e061b 100644
--- a/map.c
+++ b/map.c
@@ -664,6 +664,8 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi
*
* [r] - Reverse path
*
+ * [c] - Clear the map
+ *
* [s] - Save the map to a plaintext file
*
* [q] - Exit the map editor
@@ -751,6 +753,15 @@ void map_editor(Map *map, size_t *width, size_t *height, Position *start, Positi
path_reverse(&path, *width, *height, start, goal);
break;
+ case 'c':
+ map_free(*map, *height);
+ path_free(path, *height);
+ *map = empty_map(*width, *height);
+ if (should_pathfind) {
+ path = path_func(dirs, *map, NULL, *width, *height, *start, *goal, visited, 0);
+ }
+ break;
+
case 's':
curs_set(2); /* Show the cursor */
echo(); /* Echo characters */