From f438c6d0c5100b3a9943268b2e734380b9e61dd5 Mon Sep 17 00:00:00 2001
From: PabstMirror <elephantisaterriblemascot@gmail.com>
Date: Thu, 16 Jul 2015 18:10:10 -0500
Subject: [PATCH] Revert "Use new worldSize command instead of whileLoop"

This reverts commit 7d26519b2eeec41f417071d32e853f9e8b40669b.
---
 addons/common/functions/fnc_getMapGridData.sqf | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/addons/common/functions/fnc_getMapGridData.sqf b/addons/common/functions/fnc_getMapGridData.sqf
index e542c9d818..308772bfff 100644
--- a/addons/common/functions/fnc_getMapGridData.sqf
+++ b/addons/common/functions/fnc_getMapGridData.sqf
@@ -47,8 +47,17 @@ if (_letterGrid) exitWith {
     diag_log text format ["[ACE] Map Grid Warning (%1) - Map uses letter grids [%2,%3]", worldName, _formatX, _formatY];
 };
 
+//Start at [0, 500] and move north until we get a change in grid
+_heightOffset = 500;
+_startGrid = mapGridPosition [0, _heightOffset];
+_originGrid = _startGrid;
+while {_startGrid == _originGrid} do {
+    _heightOffset = _heightOffset + 1;
+    _originGrid = mapGridPosition [0, _heightOffset];
+};
+
 //Calculate the real y offset
-_realOffsetY = worldSize - _stepY - 1;
+_realOffsetY = parseNumber (_originGrid select [(count _formatX), (count _formatY)]) * _stepY + _heightOffset - 1;
 
 //Calculate MGRS 10digit step - they should both be 1 meter:
 _stepXat5 = _stepX * 10 ^ ((count _formatX) - 5);