Fix offset, remove debug

This commit is contained in:
VKing 2015-05-10 12:36:44 +02:00
parent 9d527bf6d2
commit e6f27f9612

View File

@ -13,12 +13,12 @@
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
private "_pos";
_pos = getPos player;
TRACE_1("",_pos);
// PARAMS_1(_pos);
// private "_pos";
// _pos = getPos player;
// TRACE_1("",_pos);
PARAMS_1(_pos);
private ["_posX","_posY","_northingReversed","_mapsize","_originGrid","_originArray","_length","_offsetX","_offsetY","_gridX","_gridY"];
private ["_posX","_posY","_northingReversed","_mapsize","_originGrid","_originArray","_length","_offsetX","_offsetY","_offsetPadding","_gridX","_gridY"];
// _northingReversed = [] call CBA_fnc_northingReversed;
_northingReversed = false;
@ -40,7 +40,7 @@ if (_northingReversed) then {
} else {
_originGrid = mapGridPosition [0,0,0];
};
// _originGrid = "1234567890";
// _originGrid = "123456";
TRACE_1("",_originGrid);
if (count _originGrid == 10) exitWith {
@ -51,9 +51,15 @@ if (count _originGrid == 10) exitWith {
_originArray = toArray _originGrid;
_length = (count _originArray);
_length = _length/2;
_offsetX = parseNumber (toString (_originArray select [0,_length]));
_offsetY = parseNumber (toString (_originArray select [_length,_length]));
_offsetPadding = switch (_length) do {
case 1: {"0000"};
case 2: {"000"};
case 3: {"00"};
case 4: {"0"};
default {};
};
_offsetX = parseNumber (toString (_originArray select [0,_length]) + _offsetPadding);
_offsetY = parseNumber (toString (_originArray select [_length,_length]) + _offsetPadding);
TRACE_2("",_offsetX,_offsetY);
TRACE_2("",_pos select 0, _pos select 1);
@ -72,19 +78,19 @@ if (_posY < 0) then {_posY = 100000 + _posY};
_posY = format["%1",_posY];
TRACE_2("",_posX,_posY);
switch (count _posX) do {
case 1: {_posX = "0000"+_posX};
case 2: {_posX = "000"+_posX};
case 3: {_posX = "00"+_posX};
case 4: {_posX = "0"+_posX};
default {};
_posX = switch (count _posX) do {
case 1: {"0000"+_posX};
case 2: {"000"+_posX};
case 3: {"00"+_posX};
case 4: {"0"+_posX};
default {_posX};
};
switch (count _posY) do {
case 1: {_posY = "0000"+_posY};
case 2: {_posY = "000"+_posY};
case 3: {_posY = "00"+_posY};
case 4: {_posY = "0"+_posY};
default {};
_posY = switch (count _posY) do {
case 1: {"0000"+_posY};
case 2: {"000"+_posY};
case 3: {"00"+_posY};
case 4: {"0"+_posY};
default {_posY};
};
TRACE_3("",mapGridPosition _pos,_posX,_posY);