API Request: TileIndex to TownID function

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

API Request: TileIndex to TownID function

Post by MinchinWeb »

Would it be possible to add a function that, given a tile index (assumed to be the seed tile of a town), would return the TownID of the town? Effectively this is the inverse of AITown.GetLocation().
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
krinn
Transport Coordinator
Transport Coordinator
Posts: 342
Joined: 29 Dec 2010 19:36

Re: API Request: TileIndex to TownID function

Post by krinn »

User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: API Request: TileIndex to TownID function

Post by MinchinWeb »

Code: Select all

AITile.GetTownAuthority (tile)
Thanks krinn...not sure how I missed that that would work.

Happy New Year to you too! :)
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests