From a48f3c5a7c0540e8d0f0e5fca76a34894e3c1c74 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Tue, 31 May 2011 16:31:13 +0100 Subject: [PATCH] Fix handling of floors (fixes 28) --- TomTom.lua | 8 +++++--- TomTom_POIIntegration.lua | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 2d7c8e6..a27214c 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -217,9 +217,11 @@ function TomTom:GetCurrentPlayerPosition() -- Try to get the position without 'flipping' the map local m, f, x, y = astrolabe:GetUnitPosition("player", true) if m and x and y and not (x <= 0 or y <= 0) then - local floors = astrolabe:GetNumFloors(m) - local floor = floors == 0 and 0 or 1 - return m, floor, x, y + if not f then + local floors = astrolabe:GetNumFloors(m) + f = floors == 0 and 0 or 1 + end + return m, f, x, y end end diff --git a/TomTom_POIIntegration.lua b/TomTom_POIIntegration.lua index ba5e239..c991a26 100644 --- a/TomTom_POIIntegration.lua +++ b/TomTom_POIIntegration.lua @@ -32,7 +32,7 @@ local function ObjectivesChanged() local map, floor = GetCurrentMapAreaID() local floors = astrolabe:GetNumFloors(map) - floor = floors == 0 and 0 or 1 + floor = floor and floor or (floors == 0 and 0 or 1) local px, py = GetPlayerMapPosition("player") -- 1.7.9.5