You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Town var 80 is the XY of the town. On a 256x256 map, the variable returns the expected values. On all map sizes, the X value in the low byte appears to work correctly (town X position truncated to a byte).
On larger or smaller maps, however, the Y value becomes erratic. On larger map sizes, it multiplies, and can take an overflow from the X coordinate. On smaller map sizes, it halves, with odd values underflowing into the X coordinate. The behaviour seems to be the same whether the variable is accessed as the high byte of var 80, or as var 81.
A test newgrf is attached. The reported values from var 80 are stored in the persistent town registers - to view them, inspect a test house then click the "parent" button.
Doubled Y value on 512x map
Halved Y value (with underflow) on 128x map testhouse.zip
The text was updated successfully, but these errors were encountered:
Var 80 is not part of the specs, and the meaning has diverged a bit from the original TTD meaning. So i don't think this is technically a bug, but the behavior might need better documentation.
Basically, you need to read out the "X" bits from "Patch Var 13" and then recreate the TileX/TileY functions, this will be correct for all map sizes (smaller or bigger)
Town var 80 is the XY of the town. On a 256x256 map, the variable returns the expected values. On all map sizes, the X value in the low byte appears to work correctly (town X position truncated to a byte).
On larger or smaller maps, however, the Y value becomes erratic. On larger map sizes, it multiplies, and can take an overflow from the X coordinate. On smaller map sizes, it halves, with odd values underflowing into the X coordinate. The behaviour seems to be the same whether the variable is accessed as the high byte of var 80, or as var 81.
A test newgrf is attached. The reported values from var 80 are stored in the persistent town registers - to view them, inspect a test house then click the "parent" button.
Doubled Y value on 512x map
Halved Y value (with underflow) on 128x map
testhouse.zip
The text was updated successfully, but these errors were encountered: