API additions 31/7/2009 - 1/8/2009

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
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

API additions 31/7/2009 - 1/8/2009

Post by Yexo »

For those of you who don't follow the commit log, here a summary of the API changes / additions in the past hours. For the documentation I'll refer you to api docs that'll be regenerated with the next nightly. If you have any questions about the newly added functions, feel free to ask them here. For discussion about other functions you think should be added, we have the topic Some API extension ideas.

-Add [NoAI]: AIAbstractList::SORT_ASCENDING / SORT_DESCENDING (svn r17005)
You can still use true/false as second parameter for AIAbstractList.Sort, but it's recommended to use the constants AIAbstractList.SORT_ASCENDING (=true) and AIAbstractList.SORT_DESCENDING (=false).

-Change [NoAI]: Add AIBaseStation as a parentclass for AIStation and AIWaypoint, and move GetName, SetName and GetLocation to AIBaseStation (svn r17011)
In trunk waypoints are internally stations now and this change has been reflected in the API. Nothing to worry about, since AIStation.GetName will still work. This change won't be backported to 0.7 so if you plan to stay compatible to 0.7 don't use AIBaseStation but call its functions on AIStation/AIWaypoint.

-Add [NoAI]: AIBaseStation::GetConstructionDate(StationID) (svn r17012)
This will probably get backported as AISation::GetConstructionDate with a possible duplicate in AIWaypoint. It returns a date, use AIDate to extract year/month/day out of it.

-Add [NoAI]: AIEngine::GetDesignDate(EngineID) (svn r17014)
Get the design date of an engine (it's a date, not a year).

-Add [NoAI]: AICompany::Get/Set PresidentGender (svn r17016)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: API additions 31/7/2009 - 1/8/2009

Post by Zuu »

Together with the change below you are awesome! Thank you Yexo.
Yexo in the 'some API extension ideas' thread wrote:
  • Load latest version of AI that can load the data, don't load exact same version first.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Chruker
Engineer
Engineer
Posts: 49
Joined: 01 Jun 2009 20:13

Re: API additions 31/7/2009 - 1/8/2009

Post by Chruker »

Thanks yexo
Blustuff
Engineer
Engineer
Posts: 112
Joined: 21 Aug 2008 09:37
Location: France

Re: API additions 31/7/2009 - 1/8/2009

Post by Blustuff »

Thank you !
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: API additions 31/7/2009 - 1/8/2009

Post by fanioz »

Thanks, it was great :D
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
User avatar
Dustin
Transport Coordinator
Transport Coordinator
Posts: 272
Joined: 07 Dec 2005 19:22

Re: API additions 31/7/2009 - 1/8/2009

Post by Dustin »

Excellent. Thanks!
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 3 guests