diff options
Diffstat (limited to 'path.c')
| -rw-r--r-- | path.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } } |
