diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-26 13:50:12 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-26 13:50:12 +0300 |
| commit | 065abf63fd79397552347c8f2d587cd99426a309 (patch) | |
| tree | 6f3dc132e5fe4c8fecf613883b5e76f9faaf23f7 /path.c | |
| parent | 0a6f8b49723aa8da143953bc011582542d2f2010 (diff) | |
| download | astar-065abf63fd79397552347c8f2d587cd99426a309.tar.xz | |
Add ppq_insert() return codes + fix breadth_first_search_4dir()
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; } } |
