From 04d6b474f928775ea0019928fdfbf08ecaae0997 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sat, 4 Apr 2026 15:41:19 +0300 Subject: Poorly implement the map editor --- main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 8f2861f..fa2207b 100644 --- a/main.c +++ b/main.c @@ -51,6 +51,7 @@ void init_ncurses(void) { cbreak(); /* Process input one char at a time */ curs_set(0); /* Hide the cursor */ noecho(); /* Don't echo characters */ + keypad(stdscr, TRUE); initialize_colors(); } @@ -157,6 +158,7 @@ int main(int argc, char **argv) { case 'i': if(is_maze) { switch (c) { + /* TODO: handle if it's zero */ case 'y': mwidth -= 1; break; case 'o': mwidth += 1; break; case 'u': mheight += 1; break; @@ -190,6 +192,16 @@ int main(int argc, char **argv) { path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); } break; + case 'e': + is_maze = 0; + visited_free(visited, height); + path_free(path, height); + + map_editor(&map, &width, &height, &start_pos, &end_pos); + + visited = visited_new(width, height); + path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + break; case 'q': map_free(map, height); path_free(path, height); endwin(); return 0; } } -- cgit v1.2.3