changeset 47:768c5f3587c2

Added optional location_label parameter to UpdateDBEntryLocation() to differentiate fishing locations, since the serializer is incapable of properly handling same-name fields with different values which are located in completely different tables.
author James D. Callahan III <jcallahan@curse.com>
date Wed, 20 Jun 2012 15:14:06 -0500
parents 786292c0bcc8
children 4668938a63e5
files Main.lua
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Main.lua	Wed Jun 20 12:29:02 2012 -0500
+++ b/Main.lua	Wed Jun 20 15:14:06 2012 -0500
@@ -251,21 +251,22 @@
 end -- do-block
 
 
-local function UpdateDBEntryLocation(entry_type, identifier)
+local function UpdateDBEntryLocation(entry_type, identifier, location_label)
     if not identifier then
         return
     end
     local zone_name, area_id, x, y, map_level, difficulty_token = CurrentLocationData()
     local entry = DBEntry(entry_type, identifier)
+    local location_field = location_label or "locations"
     entry[difficulty_token] = entry[difficulty_token] or {}
-    entry[difficulty_token].locations = entry[difficulty_token].locations or {}
+    entry[difficulty_token][location_field] = entry[difficulty_token][location_field] or {}
 
     local zone_token = ("%s:%d"):format(zone_name, area_id)
-    local zone_data = entry[difficulty_token].locations[zone_token]
+    local zone_data = entry[difficulty_token][location_field][zone_token]
 
     if not zone_data then
         zone_data = {}
-        entry[difficulty_token].locations[zone_token] = zone_data
+        entry[difficulty_token][location_field][zone_token] = zone_data
     end
     local location_token = ("%s:%s:%s"):format(map_level, x, y)
     zone_data[location_token] = zone_data[location_token] or true
@@ -1223,7 +1224,7 @@
             action_data.identifier = identifier
         elseif bit.band(spell_flags, AF.ZONE) == AF.ZONE then
             local identifier = ("%s:%s"):format(spell_label, _G["GameTooltipTextLeft1"]:GetText() or "NONE") -- Possible fishing pool name.
-            action_data.zone_data = UpdateDBEntryLocation("zones", identifier)
+            action_data.zone_data = UpdateDBEntryLocation("zones", identifier, "fishing_locations")
             action_data.type = AF.ZONE
             action_data.identifier = identifier
         end