diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-29 21:55:01 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-29 21:55:01 +0300 |
| commit | a3d42f5b23df682e3386940b4d92632f9f4c60db (patch) | |
| tree | 76d978280437fd06b076d144407975a3d64ee6c5 /priority_queue.c | |
| parent | 2f8fba218e9db6f0835500c49d1b74155c96d43b (diff) | |
| download | astar-a3d42f5b23df682e3386940b4d92632f9f4c60db.tar.xz | |
Implement A*, finally
Diffstat (limited to 'priority_queue.c')
| -rw-r--r-- | priority_queue.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/priority_queue.c b/priority_queue.c index d899103..c90f661 100644 --- a/priority_queue.c +++ b/priority_queue.c @@ -35,7 +35,8 @@ int ppq_insert(PositionPQ **ppq, Position pos, size_t priority) { PositionPQ *temp = *ppq; - while(temp->next != NULL && temp->next->priority <= priority) { + /* The '=' is commented out because we want to insert before, for speed. To insert after, uncomment it*/ + while(temp->next != NULL && temp->next->priority </*=*/ priority) { if (temp->pos.x == pos.x && temp->pos.y == pos.y && temp->priority <= priority) { free(n); return PPQ_INSERT_ALREADY; |
