From d116348ff895e477b98f1e23e88fb65726c7918d Mon Sep 17 00:00:00 2001 From: smariot Date: Tue, 6 May 2008 13:21:47 -0400 Subject: [PATCH] Fixed a bug where an objective could be added to the route multiple times if inserted at the end. --- routing.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routing.lua b/routing.lua index 67f9bbc..6380b37 100644 --- a/routing.lua +++ b/routing.lua @@ -176,6 +176,7 @@ function QuestHelper:InsertObjectiveIntoRoute(array, distance, extra, objective, local o = array[#array] o.len, objective.pos = objective:TravelTime(array[#array].pos) yieldIfNeeded() + if old_index > 0 then table.remove(array, old_index) end table.insert(array, objective) return #array, distance+o.len, extra else @@ -393,6 +394,7 @@ function QuestHelper:InsertObjectiveIntoRouteSOP(array, distance, extra, objecti local o = array[#array] o.nel, objective.sop = objective:TravelTime(array[#array].sop) yieldIfNeeded() + if old_index > 0 then table.remove(array, old_index) end table.insert(array, objective) return #array, distance+o.nel, extra else -- 2.11.4.GIT