Fix some bugs in quest objective source
James Whitehead II [01-11-11 - 09:54]
Fix some bugs in quest objective source
diff --git a/sources/QuestObjectives.lua b/sources/QuestObjectives.lua
index 1e1b728..b2f6cfd 100644
--- a/sources/QuestObjectives.lua
+++ b/sources/QuestObjectives.lua
@@ -62,6 +62,7 @@ function addon:OBJECTIVES_CHANGED()
-- Scan through every quest that is being tracked, and create a waypoint
-- for each of the objectives that are being tracked. These waypoints will
-- be unordered, and will be sorted or ordered by the user/algorithm
+ local first
local watchIndex = 1
while true do
local questIndex = GetQuestIndexForWatch(watchIndex)
@@ -84,13 +85,16 @@ function addon:OBJECTIVES_CHANGED()
end
local key = title .. tostring(qid + (x * 100) * (y * 100) * map * (floor + 1))
+ if not first then
+ first = key
+ end
if waypoints[key] then
-- This waypoint already exists, no need to do anything, except
-- possibly change the priority
local waypoint = waypoints[key]
- local newpri = (watchIndex == 1) and addon.PRI_ACTIVE or addon.PRI_NORMAL
+ local newpri = key == first and addon.PRI_ACTIVE or addon.PRI_NORMAL
if waypoint.priority ~= newpri then
changed = true
waypoint.priority = newpri
@@ -101,7 +105,7 @@ function addon:OBJECTIVES_CHANGED()
-- Create the waypoint, setting priority
local waypoint = self:AddWaypoint(map, floor, x, y, {
title = title,
- priority = (watchIndex == 1) and addon.PRI_ACTIVE or addon.PRI_NORMAL,
+ priority = key == first and addon.PRI_ACTIVE or addon.PRI_NORMAL,
})
newWaypoints[key] = waypoint