Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CBA_fnc_mapGridToPos off by one #1579

Merged
merged 1 commit into from
Jun 24, 2023
Merged

Fix CBA_fnc_mapGridToPos off by one #1579

merged 1 commit into from
Jun 24, 2023

Conversation

artemoz
Copy link
Contributor

@artemoz artemoz commented Jun 22, 2023

Fix #1362

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, leading to [-1, -1, 0] offset mentioned in the issue.
Manual tests on Altis/Stratis/Malden/VR/Livonia seem to return proper results.

When merged this pull request will:

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
@jonpas jonpas changed the title Fix https://github.com/CBATeam/CBA_A3/issues/1362 Fix CBA_fnc_mapGridToPos off by one Jun 24, 2023
@jonpas jonpas merged commit 191deb8 into CBATeam:master Jun 24, 2023
@jonpas jonpas changed the title Fix CBA_fnc_mapGridToPos off by one Fix CBA_fnc_mapGridToPos off by one Jun 24, 2023
@jonpas jonpas added this to the 3.15.9 milestone Jun 24, 2023
@jonpas jonpas added the Bug Fix label Jun 24, 2023
@artemoz artemoz deleted the 1362fix branch June 24, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

off by one error in CBA_fnc_mapGridToPos
2 participants