From bab2ff2090e875ec5c0465e0d39011b0382d4c9e Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Wed, 15 Apr 2026 17:38:50 +0300 Subject: Add costs everywhere --- main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 1fdf05c..39f9754 100644 --- a/main.c +++ b/main.c @@ -19,7 +19,7 @@ - Maybe make map editor the main thing - More messages - check ppq_insert() order - - more info in anim() + - more info in anim()? - save pathfinding to a series of BMPs - less magical values - MORE MAPS FOR THE MAP PEOPLE @@ -135,11 +135,13 @@ int main(int argc, char **argv) { if (!bmp_only) { init_ncurses(); + draw_map(map, width, height, start_pos, end_pos, NULL, NULL, NULL, NULL); + wrefresh(stdscr); } char **visited = visited_new(width, height); Path path = NULL; - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); if (bmp_only) { map_to_bmp(map, width, height, start_pos, end_pos, path, visited, bmp_filename); @@ -154,8 +156,6 @@ int main(int argc, char **argv) { while (1) { draw_map(map, width, height, start_pos, end_pos, NULL, path, visited, NULL); int c = getch(); - /* TODO: add a keybinding to calculate the path again, or maybe do it on 'a' */ - /* TODO: add a keybinding to load a map from a file */ switch (c) { case 'h': map_offset_x += 2; break; case 'l': map_offset_x -= 2; break; @@ -191,7 +191,7 @@ int main(int argc, char **argv) { else anim = 1; path_free(path, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); clear_message(); break; @@ -199,7 +199,7 @@ int main(int argc, char **argv) { if (path_func == astar_path) { set_message("Dijkstra"); path_func = &dijkstra_path; } else { set_message("A*"); path_func = &astar_path; }; path_free(path, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); break; case 'y': @@ -224,7 +224,7 @@ int main(int argc, char **argv) { map = rbt_maze_map(mwidth, mheight, rand()); visited = visited_new(width, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); } break; @@ -260,7 +260,7 @@ int main(int argc, char **argv) { map = file_plaintext_map(filename, &width, &height, &start_pos, &end_pos); visited = visited_new(width, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); set_message("Loaded map from %s", filename); print_message(height); @@ -274,7 +274,7 @@ int main(int argc, char **argv) { map_free(map, height); map = rbt_maze_map(mwidth, mheight, rand()); path_free(path, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); } break; @@ -288,7 +288,7 @@ int main(int argc, char **argv) { wrefresh(curscr); visited = visited_new(width, height); - path = path_func(dirs, map, width, height, start_pos, end_pos, visited, anim); + path = path_func(dirs, map, NULL, width, height, start_pos, end_pos, visited, anim); break; case KEY_RESIZE: clear(); break; -- cgit v1.2.3