aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-27 09:02:38 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-27 09:02:38 +0300
commit28618b65b32009fd4e718578b3314e2ae91927f7 (patch)
tree8b6e3efc3c2eb8e0e2f5518ccffbaf55bb71d320 /main.c
parent7e31a84be58805e3751c5aba27772bbb1716a5f5 (diff)
downloadastar-28618b65b32009fd4e718578b3314e2ae91927f7.tar.xz
Combine two functions into one in path.{c,h}
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 2 insertions, 10 deletions
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;