aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'path.c')
-rw-r--r--path.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/path.c b/path.c
index 6f00ee8..e32610b 100644
--- a/path.c
+++ b/path.c
@@ -49,8 +49,9 @@ Path breadth_first_search_path_4dir(Map map, size_t width, size_t height, Positi
/* The Russian constitution doesn't allow walking on walls */
if (map[na[i].y][na[i].x] == WALL) continue;
- ppq_insert(&frontier, na[i], 0);
- path[na[i].y][na[i].x].parent = cur;
+ if (ppq_insert(&frontier, na[i], 0) != PPQ_INSERT_ALREADY) {
+ path[na[i].y][na[i].x].parent = cur;
+ }
}
if (should_anim) {
@@ -91,7 +92,7 @@ Path breadth_first_search_path_8dir(Map map, size_t width, size_t height, Positi
/* The Russian constitution doesn't allow walking on walls */
if (map[na[i].y][na[i].x] == WALL) continue;
- if (ppq_insert(&frontier, na[i], 0) != 3) {
+ if (ppq_insert(&frontier, na[i], 0) != PPQ_INSERT_ALREADY) {
path[na[i].y][na[i].x].parent = cur;
}
}