summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/kit/astar.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/source/kit/astar.h b/source/kit/astar.h
index b76ef67..6f0d1b5 100644
--- a/source/kit/astar.h
+++ b/source/kit/astar.h
@@ -227,7 +227,8 @@ static s32 NAME_(astar_iteration)(Astar_State *state) {
{
i64 index_in_open = 0;
for (i64 i = 1; i < state->open.size; i++)
- if (state->open.values[i].estimate < state->open.values[index_in_open].estimate)
+ if (state->open.values[i] .exact_distance + state->open.values[i] .estimate <
+ state->open.values[index_in_open].exact_distance + state->open.values[index_in_open].estimate)
index_in_open = i;
nearest_node = state->open.values[index_in_open];
if (index_in_open != state->open.size - 1)