Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Town Y value reported by var 80 is inconsistent on different map sizes #7149
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.