From a3d42f5b23df682e3386940b4d92632f9f4c60db Mon Sep 17 00:00:00 2001 From: Kirill Petrashin Date: Sun, 29 Mar 2026 21:55:01 +0300 Subject: Implement A*, finally --- priority_queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'priority_queue.c') 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 pos.x == pos.x && temp->pos.y == pos.y && temp->priority <= priority) { free(n); return PPQ_INSERT_ALREADY; -- cgit v1.2.3