diff WorldQuests.lua @ 82:26d736fbfe67 v1.4.4

- Fixed filter bar issues
author Nenue
date Mon, 10 Apr 2017 17:29:28 -0400
parents 5d33e98710a0
children a12f782571c5
line wrap: on
line diff
--- a/WorldQuests.lua	Mon Apr 10 16:44:45 2017 -0400
+++ b/WorldQuests.lua	Mon Apr 10 17:29:28 2017 -0400
@@ -573,18 +573,19 @@
 
 -- Updates quest markers in taskInfo while associating them with the given map
 function Module:UpdateQuestsForMap(taskInfo, mapID)
-  if mapID then
-    db.QuestsByZone[mapID] = db.QuestsByZone[mapID] or {}
+  print('UpdateQuestsForMap()', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID), layoutDirty)
+  if db.QuestsByZone[mapID] then
     wipe(db.QuestsByZone[mapID])
   end
-  print('UpdateQuestsForMap()', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID), layoutDirty)
+
+
   for index, info in pairs(taskInfo) do
 
     local questID, x, y = info.questId, info.x, info.y
     local pin = self:AcquirePin(info)
 
     if pin then
-      print(pin.title, pin.isStale)
+      print(pin.title, pin.isStale, layoutDirty, (pin.owningFrame ~= WorldMapFrame))
       if pin:IsShown() and (layoutDirty or pin.isStale or (pin.owningFrame ~= WorldMapFrame)) then
         local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
         pin.owningFrame = WorldMapFrame
@@ -592,15 +593,15 @@
         if pin.isStale then
           pin:Refresh('WORLDMAP_REFRESH ' .. GetTime())
         end
-        if mapID then
-          db.QuestsByZone[mapID][questID] = pin
-        end
       else
         if layoutDirty then
           pin.isStale = true
         end
       end
 
+      if db.QuestsByZone[mapID] and pin.used then
+        db.QuestsByZone[mapID][questID] = pin
+      end
 
     end
   end
@@ -634,6 +635,9 @@
     for i = 1, numZones do
       local mapAreaID = MC_GetZoneInfo(db.currentMapID, i)
       local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, db.currentMapID)
+
+      db.QuestsByZone[mapAreaID] = db.QuestsByZone[mapAreaID] or {}
+
       if taskInfo then
         self:UpdateQuestsForMap(taskInfo, mapAreaID)
       end