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

off by one error in CBA_fnc_mapGridToPos #1362

Closed
warzen opened this issue Aug 20, 2020 · 2 comments · Fixed by #1579
Closed

off by one error in CBA_fnc_mapGridToPos #1362

warzen opened this issue Aug 20, 2020 · 2 comments · Fixed by #1579
Labels
Milestone

Comments

@warzen
Copy link

warzen commented Aug 20, 2020

Mods (complete and add to the following information):

  • Arma 3: 1.98.146373
  • CBA: `3.15.1
    Make sure to reproduce the issue with only CBA on a newly created mission!
    Only CBA, new mission.

Description:
both coordinates returned by CBA_fnc_mapGridToPos are wrong by one unit

Steps to reproduce:
example1: "000000" call CBA_fnc_mapGridToPos => [-1,-1,0] , it should be [0,0,0]
example2: "141212" CBA_fnc_mapGridToPos => [14099,21199,0] and that's in 140,211, not in 141,212

Where did the issue occur?
Editor (Singleplayer)

@Drofseh
Copy link
Contributor

Drofseh commented Aug 21, 2020

Hmm, strictly speak a grid designation refers to the whole square as well, not the bottom left corner.
Grid 141212 encompasses everything from positions [14100.00,21200.00] to [14199.99,21299.99] inclusive.
So in a mapping/military context it might make sense to return the centre of the grid for position.
"141212" call CBA_fnc_mapGridToPos //return [14150,21250]

Apparently it's supposed to be returning either centre or upper left if the _doOffSet parameter is true or false.
Upper left is always wrong in a map context since the grid number is taken from the bottom left of the grid square.

@warzen
Copy link
Author

warzen commented Aug 21, 2020

["0000000000",true] call CBA_fnc_mapGridToPos is returning [-1,-1,0] so in fact we have two bugs here:

  • the off by one error on the calculation
  • the fact that the lower left is return when _doOffSet is false. In this case, the two bugs are occuring.

And honestly, I don't know why you would want the upper left corner (as described in the doc). Bottom left seems more natural.

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 a pull request may close this issue.

3 participants