Skip to content

Commit

Permalink
Update fnc_mapGridToPos.sqf (#1579)
Browse files Browse the repository at this point in the history
With check-decrement ordering the while loops execute twice, leaving _minus at -2, then _rvOriginX/_rvOriginY get set to 0 + (abs - 2) - 1 = 1 (and get cached at GVAR(rvOriginX)/GVAR(rvOriginY)), then at line 176 said variables get subtracted from previous calculated coordinates
  • Loading branch information
artemoz committed Jun 24, 2023
1 parent 2029124 commit 191deb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/common/fnc_mapGridToPos.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ if (IS_STRING(_pos)) then {
private _check = _start;
private _minus = 0;
while {_check == _start} do {
_check = format["%1", mapGridPosition [0, _minus]];
_minus = _minus - 1;
_check = format["%1", mapGridPosition [0, _minus]];
};
_rvOriginY = _rvOriginY+(abs _minus)-1;
_minus = 0;
_check = _start;
while {_check == _start} do {
_check = format["%1", mapGridPosition [_minus, 0]];
_minus = _minus - 1;
_check = format["%1", mapGridPosition [_minus, 0]];
};
_rvOriginX = _rvOriginX+(abs _minus)-1;
};
Expand Down

0 comments on commit 191deb8

Please sign in to comment.