From c9ac361e1282bfaa895a1456222bca2d86253a96 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Tue, 14 Apr 2026 22:41:56 +0300 Subject: Implement live pathfinding in map editor --- main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index c909633..9706875 100644 --- a/main.c +++ b/main.c @@ -16,6 +16,8 @@ /* So, TODO for now: - Allow maps to have costs + - Maybe make map editor the main thing + - More messages - check ppq_insert() order - more info in anim() - save pathfinding to a series of BMPs @@ -23,7 +25,6 @@ - MORE MAPS FOR THE MAP PEOPLE - Clean up unused `#include`s - keybinding help screen - - live updating in map_editor() - 'clean' rendering mode, without all the ugly shit - Comments */ @@ -61,7 +62,6 @@ int main(int argc, char **argv) { Position start_pos, end_pos; size_t width, height; Map map = NULL; - Path (*path_func)(int, Map, size_t, size_t, Position, Position, char **, char) = &astar_path; size_t mwidth = 20; /* Maze width */ size_t mheight = 10; /* Maze height */ @@ -145,6 +145,10 @@ int main(int argc, char **argv) { exit(0); } +#ifdef PID_MESSAGE + set_message("PID: %i", getpid()); +#endif + while (1) { draw_map(map, width, height, start_pos, end_pos, NULL, path, visited, NULL); int c = getch(); @@ -253,7 +257,8 @@ int main(int argc, char **argv) { visited_free(visited, height); path_free(path, height); - map_editor(&map, &width, &height, &start_pos, &end_pos); + map_editor(&map, &width, &height, &start_pos, &end_pos, dirs); + set_message("You've left the map editor"); print_message(height); wrefresh(curscr); visited = visited_new(width, height); -- cgit v1.2.3