Page MenuHomeFeedback Tracker

mapGridPosition returning wrong map grid coordinates at edge cases (Caution: Hashmaps!)
New, NormalPublic

Description

mapGridPosition will return wrong coordinates for SOME NOT ALL positional data input with floored edge case values, e.g. mapGridPosition [8500,4700] will erroneously return "084046", whereas mapGridPosition [8600,5000] will correctly return "086050".

EDIT2: Severity could arguably be 'Major' if returned values from script-generated sources are used in hashmap key generation/retrieval (and go unnoticed). I noticed this as I was writing an algorithm that should not have produced duplicates in a tree, but did, but only after using mapGridPosition. I've remedied that so far by just _pos vectorAdd [50, 50] before converting to grid coordinates. str _pos also works as a surprisingly reliable key, at least when using floored multiples of 100 in position coordinates.

Details

Severity
Minor
Resolution
Open
Reproducibility
Always
Operating System
Linux x64
Operating System Version
LMDE 6 / Cinnamon / (virtually) Stock Settings
Category
Engine
Steps To Reproduce
  • have any Arma debug console available
  • mapGridPosition [8500,4700]
  • should return "085047" but returns "084046"

EDIT: Fixed typo.

Additional Information

I'm running Arma 3 in Proton Experimental in Flatpak'ed Steam on LMDE 6, with all the latest updates applied. It's not impossible this might be an isolated issue due to my setup, this wouldn't be the first time Arma was doing something weird on Linux it didn't do on Windows.

I also don't know if this is something that would otherwise incur a performance hit, such that these inaccuracies are thus taken into account and otherwise to be expected (there was no information regarding this on the Wiki).

I'd appreciate confirmation.

A temporary workaround is to add or subtract 50m to the x,y values.

Event Timeline

cr4qsh0t created this task.Oct 30 2024, 1:32 AM
cr4qsh0t edited Steps To Reproduce. (Show Details)Oct 30 2024, 1:44 AM
cr4qsh0t renamed this task from mapGridPosition returning wrong map grid coordinates at edge cases to mapGridPosition returning wrong map grid coordinates at edge cases (Caution: Hashmaps!).Oct 30 2024, 3:46 AM
cr4qsh0t updated the task description. (Show Details)

Is the grid position not matching map grid square?

I don't think so, I would expect {mapGridPosition [8500,4700]} to return "085047", not "084046", because 8500m mod 100m = 0m and 8500m / 100m = 85, thus {mapGridPosition [8500,4700]} should return "085047".

It seems to only have this problem with floored odd multiples of 100m, like 8500, 4700, 8300, etc.

This comment was removed by Leopard20.
This comment was removed by Leopard20.