From e65d93aa709e11ded71b18e5da9ba0bfc7812e2f Mon Sep 17 00:00:00 2001 From: Aklakina Date: Sat, 24 Feb 2024 13:04:26 +0100 Subject: [PATCH] indexing fixes --- src/common/environment.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/environment.lua b/src/common/environment.lua index a2ee985..3dc2396 100644 --- a/src/common/environment.lua +++ b/src/common/environment.lua @@ -311,7 +311,7 @@ function Environment:dijkstra(source, targets) local alt = distance[tostring(current)] + self:getCost(data.type) if not distance[tostring(data.position)] then distance[tostring(data.position)] = math.huge - queue:insert(data.position, math.huge + self:heuristic(data.position, targets[1])) -- heuristic from the first target + queue:insert(data.position, math.huge + self:heuristic(data.position, targets)) -- heuristic from the first target end if alt < distance[tostring(data.position)] then distance[tostring(data.position)] = alt