diff Main.lua @ 482:f924bec6cf5e

Prevent out of bounds coordinates from being recorded for whatever reason.
author MMOSimca <mmosimca@gmail.com>
date Fri, 12 Aug 2016 12:32:50 -0400
parents 6f689ac680bd
children 271132f4fa77
line wrap: on
line diff
--- a/Main.lua	Thu Aug 11 09:36:45 2016 -0400
+++ b/Main.lua	Fri Aug 12 12:32:50 2016 -0400
@@ -326,16 +326,30 @@
     local x_int = nil
     if (x and type(x) == "number") then
         x_int = _G.floor(x * 1000)
+        
+        -- Limit precision to 0.2
         if x_int % 2 ~= 0 then
             x_int = x_int + 1
         end
+        
+        -- Prevent out of bounds coordinates
+        if (x_int < 0 or x_int > 1000) then
+            x_int = nil
+        end
     end
     local y_int = nil
     if (y and type(y) == "number") then
         y_int = _G.floor(y * 1000)
+        
+        -- Limit precision to 0.2
         if y_int % 2 ~= 0 then
             y_int = y_int + 1
         end
+        
+        -- Prevent out of bounds coordinates
+        if (y_int < 0 or y_int > 1000) then
+            y_int = nil
+        end
     end
 
     return zone_name, current_area_id, x_int, y_int, map_level, InstanceDifficultyToken()