{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreibpvrnwd232p6j2xhd6yg6jqor6cwvb5y7mmp2c7cisroekc56whu",
"uri": "at://did:plc:i7budt2wflrcfy6jtvfocbix/app.bsky.feed.post/3met6ojlfds62"
},
"path": "/viewtopic.php?p=1278060#p1278060",
"publishedAt": "2026-02-14T12:11:48.000Z",
"site": "https://www.tt-forums.net",
"tags": [
"GoldMine"
],
"textContent": "> The key is in line 1203: function _dir(from, to)\n\nI see, what this function does is returns a factor that produces 16 possible directions, this is done by left shift to produce 16 unique numbers, out of which only 12 are needed for rail directions.\n\n\n> For some undocumented reason, this specific code only applies to tiles in Y direction, line 1066: if (parDistance > 1) branchs only if parDistance = MapSizeX.\n\nIt applies to both axes, however only to neighboring tiles that are either horizontal or vertical.\n\nI think I've grasped this case, thanks for help\n\n\nI also figured out to go further than 1 tile along Y axis it would take special formula, for instance AIMap.GetMapSize() will return same value as in game setting, however gotcha, the actual map is 2 tiles shorter on both axes lol.\n\nI've come up with partial formula so far for Y arithmetic but don't need it yet, only problem is whether one can rely on this, if devs change something it's going to be broken.\n\nStatistics: Posted by GoldMine — 14 Feb 2026 12:11\n\n* * *",
"title": "OpenTTD AIs and Game Scripts • Re: Can somebody teach me tile arithmetic?",
"updatedAt": "2026-02-14T12:11:48.000Z"
}