worldmarkers: revert locale encoding -- not a real issue on Windows
C runtime starts in "C" locale (dot decimals) on all platforms. WoW doesn't call setlocale. The integer encoding was unnecessary and would break sync with older builds.
This commit is contained in:
@@ -82,16 +82,11 @@ end
|
||||
-- Broadcast helpers
|
||||
-- =============================================================================
|
||||
|
||||
-- Encode floats as integers (*1000) to avoid locale-dependent decimal separators.
|
||||
-- Receivers divide by 1000. Sub-millimeter precision loss is irrelevant for markers.
|
||||
local function encodeCoord(v) return math.floor(v * 1000) end
|
||||
local function decodeCoord(v) return v / 1000 end
|
||||
|
||||
local function broadcastPlace(index, x, y, z, areaId)
|
||||
clearSyncState()
|
||||
local ch = getChannel()
|
||||
if not ch then return end
|
||||
local msg = "P:" .. index .. ":" .. encodeCoord(x) .. ":" .. encodeCoord(y) .. ":" .. encodeCoord(z) .. ":" .. areaId
|
||||
local msg = "P:" .. index .. ":" .. x .. ":" .. y .. ":" .. z .. ":" .. areaId
|
||||
SendAddonMessage(MSG_PREFIX, msg, ch)
|
||||
end
|
||||
|
||||
@@ -116,7 +111,7 @@ local function broadcastAllDefs()
|
||||
for i = 1, NUM_MARKERS do
|
||||
local x, y, z, areaId = GetWorldMarker(i)
|
||||
if x then
|
||||
local msg = "SF:" .. i .. ":" .. encodeCoord(x) .. ":" .. encodeCoord(y) .. ":" .. encodeCoord(z) .. ":" .. areaId
|
||||
local msg = "SF:" .. i .. ":" .. x .. ":" .. y .. ":" .. z .. ":" .. areaId
|
||||
SendAddonMessage(MSG_PREFIX, msg, ch)
|
||||
end
|
||||
end
|
||||
@@ -225,7 +220,7 @@ local function parseMarkerFields(parts)
|
||||
local z = tonumber(parts[5])
|
||||
local areaId = tonumber(parts[6])
|
||||
if idx and x and y and z and areaId then
|
||||
return idx, decodeCoord(x), decodeCoord(y), decodeCoord(z), areaId
|
||||
return idx, x, y, z, areaId
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user