aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorKirill Petrashin <kirill8201@yandex.ru>2026-04-16 22:15:51 +0300
committerKirill Petrashin <kirill8201@yandex.ru>2026-04-16 22:15:51 +0300
commitf2a99859f0c66ba17765c036a173e7f29927327a (patch)
tree88f05aaf4944f0fa5a575f9bc2ea852fa1d71e1c /path.c
parentc6db3a75f756d790ede966c34adc3dbc793803d1 (diff)
downloadastar-f2a99859f0c66ba17765c036a173e7f29927327a.tar.xz
Fix costs
Diffstat (limited to 'path.c')
-rw-r--r--path.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/path.c b/path.c
index 85f7804..6909adc 100644
--- a/path.c
+++ b/path.c
@@ -228,6 +228,7 @@ Path astar_path(int dirs, Map map, size_t **cell_costs, size_t width, size_t hei
/* The Russian constitution doesn't allow walking on walls */
if (map[na[i].y][na[i].x] == WALL) continue;
+ /* Dijkstra's works with cell_costs, why does this not? */
size_t new_cost = cost_so_far[cur.y][cur.x] + costs[i];
if (new_cost < cost_so_far[na[i].y][na[i].x]) {
cost_so_far[na[i].y][na[i].x] = new_cost;