From 28618b65b32009fd4e718578b3314e2ae91927f7 Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Fri, 27 Mar 2026 09:02:38 +0300 Subject: Combine two functions into one in path.{c,h} --- main.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 331c7b4..7c95dd8 100644 --- a/main.c +++ b/main.c @@ -122,11 +122,7 @@ int main(int argc, char **argv) { char visited[height][width]; Path path = NULL; - if (dirs == 4) { - path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited, anim); - } else { - path = breadth_first_search_path_8dir(map, width, height, start_pos, end_pos, visited, anim); - } + path = breadth_first_search_path(dirs, map, width, height, start_pos, end_pos, visited, anim); while (1) { draw_map(map, width, height, offset_x, offset_y, start_pos, end_pos, NULL, path, visited, NULL); @@ -141,11 +137,7 @@ int main(int argc, char **argv) { map_free(map, height); map = rbt_maze_map(mwidth, mheight, rand()); path_free(path, height); - if (dirs == 4) { - path = breadth_first_search_path_4dir(map, width, height, start_pos, end_pos, visited, anim); - } else { - path = breadth_first_search_path_8dir(map, width, height, start_pos, end_pos, visited, anim); - } + path = breadth_first_search_path(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