Quantcast

Use 'Unnamed Map' if the map has no known name.

Ludovicus [08-25-20 - 17:45]
Use 'Unnamed Map' if the map has no known name.
Filename
TomTom.lua
diff --git a/TomTom.lua b/TomTom.lua
index 26c05b2..4be40cc 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -712,7 +712,7 @@ function TomTom:CHAT_MSG_ADDON(event, prefix, data, channel, sender)
     x = tonumber(x)
     y = tonumber(y)

-    local zoneName = hbd:GetLocalizedMap(m)
+    local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
     self:AddWaypoint(m, x, y, {title = title, from=("TomTom/"..sender)})
     local msg = string.format(L["|cffffff78TomTom|r: Added '%s' (sent from %s) to zone %s"], title, sender, zoneName)
     ChatFrame1:AddMessage(msg)
@@ -745,7 +745,7 @@ local function _both_tooltip_show(event, tooltip, uid, dist)
         tooltip:AddLine(L["Unknown distance"])
     end
     local m,x,y = unpack(data)
-    local zoneName = hbd:GetLocalizedMap(m)
+    local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]

     tooltip:AddLine(string.format(L["%s (%.2f, %.2f)"], zoneName, x*100, y*100), 0.7, 0.7, 0.7)
     tooltip:AddLine(string.format(L["From: %s"], data.from or "?"))
@@ -918,7 +918,7 @@ function TomTom:AddWaypoint(m, x, y, opts)
 		opts.callbacks = TomTom:DefaultCallbacks(opts)
 	end

-    local zoneName = hbd:GetLocalizedMap(m)
+    local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]

     -- Ensure there isn't already a waypoint at this location
     local key = self:GetKey({m, x, y, title = opts.title})
@@ -1073,7 +1073,7 @@ do
     function Block_OnClick(self, button, down)
         local m,x,y = TomTom:GetCurrentPlayerPosition()
         if m and x and y then
-            local zoneName = hbd:GetLocalizedMap(m)
+            local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
             local desc = string.format("%s: %.2f, %.2f", zoneName, x*100, y*100)
             TomTom:AddWaypoint(m, x, y, {
                 title = desc,
@@ -1092,7 +1092,7 @@ end
 function TomTom:DebugListLocalWaypoints()
     local m,x,y = self:GetCurrentPlayerPosition()
     local ctxt = RoundCoords(x, y, 2)
-    local czone = hbd:GetLocalizedMap(m) or "UNKNOWN"
+    local czone = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
     self:Printf(L["You are at (%s) in '%s' (map: %s)"], ctxt, czone , tostring(m))
     if waypoints[m] then
         for key, wp in pairs(waypoints[m]) do
@@ -1110,11 +1110,11 @@ end
 function TomTom:DebugListAllWaypoints()
     local m,x,y = self:GetCurrentPlayerPosition()
     local ctxt = RoundCoords(x, y, 2)
-    local czone = hbd:GetLocalizedMap(m) or "UNKNOWN"
+    local czone = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
     self:Printf(L["You are at (%s) in '%s' (map: %s)"], ctxt, czone, tostring(m))
     for m in pairs(waypoints) do
         local c,z,w = TomTom:GetCZWFromMapID(m)
-        local zoneName = hbd:GetLocalizedMap(m) or "?"
+        local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
         self:Printf(L["%s: (map: %d, zone: %s, continent: %s, world: %s)"], zoneName, m, tostring(z), tostring(c), tostring(w))
         for key, wp in pairs(waypoints[m]) do
             local ctxt = RoundCoords(wp[2], wp[3], 2)
@@ -1247,7 +1247,7 @@ function TomTom:SetClosestWaypoint(verbose)
         local data = uid
         TomTom:SetCrazyArrow(uid, TomTom.profile.arrow.arrival, data.title)
         local m, x, y = unpack(data)
-        local zoneName = hbd:GetLocalizedMap(m)
+        local zoneName = hbd:GetLocalizedMap(m) or L["Unnamed Map"]
         local ctxt = RoundCoords(x, y, 2)
         local desc = data.title and data.title or ""
         local sep = data.title and " - " or ""
@@ -1396,7 +1396,7 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
                         TomTom:RemoveWaypoint(uid)
                         numRemoved = numRemoved + 1
                     end
-                    local zoneName = hbd:GetLocalizedMap(map)
+                    local zoneName = hbd:GetLocalizedMap(map) or L["Unnamed Map"]
                     if numRemoved > 0 then
                         ChatFrame1:AddMessage(L["Removed %d waypoints from %s"]:format(numRemoved, zoneName))
                     end
@@ -1454,7 +1454,7 @@ SlashCmdList["TOMTOM_WAY"] = function(msg)
                             TomTom:RemoveWaypoint(uid)
                             numRemoved = numRemoved + 1
                         end
-                        local zoneName = hbd:GetLocalizedMap(map)
+                        local zoneName = hbd:GetLocalizedMap(map) or L["Unnamed Map"]
                         if numRemoved > 0 then
                             ChatFrame1:AddMessage(L["Removed %d waypoints from %s"]:format(numRemoved, zoneName))
                         end