aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-03-22 12:23:35 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-03-22 12:23:35 +0300
commitd96ba29434808b94cccfcce7a675e5abbd2d846d (patch)
treef02ce36a0ec0acbc87d0a454062e6300445ad0f2 /path.c
parent348c700fedae3b0005660d8c42941fe7c69027d4 (diff)
Add ability to choose maps via args + create more maps + don't insert elements into a PPQ if there's one with better priority
Diffstat (limited to 'path.c')
-rw-r--r--path.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/path.c b/path.c
index 346f737..e2d42c5 100644
--- a/path.c
+++ b/path.c
@@ -27,11 +27,11 @@ Path breadth_first_search_path_4dir(Map map, size_t width, size_t height, Positi
visited[cur.y][cur.x] = 1;
if (cur.x == end.x && cur.y == end.y) {
- break;
+ return path; /* Found path */
}
Position na[4];
- unsigned int nc = neighbours(na, cur, width, height, visited);
+ unsigned int nc = neighbours_4dir(na, cur, width, height, visited);
for (unsigned int i = 0; i < nc; i++) {
/* The Russian constitution doesn't allow walking on walls */
@@ -42,7 +42,7 @@ Path breadth_first_search_path_4dir(Map map, size_t width, size_t height, Positi
}
}
- return path;
+ return NULL;
}
/* FIXME: Rewrite this shit */