[Patch] International Airport State Machine Optimization

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Vetteman06
Engineer
Engineer
Posts: 52
Joined: 03 Aug 2013 16:39

[Patch] International Airport State Machine Optimization

Post by Vetteman06 »

I got tired of the airport slowness and have been working on learning how the state machine works in OpenTTD.
So I re-wrote the entire state machine for the International Airport.
I am going to work on the others once I am sure that I have this one 100%.
It is amazingly better at handling the aircraft.

Changes:
1) Change the angle of approach for the landing runway. and made the planes land one tile in instead of edge of airport.
2) Removed the terminal blocks.
3) Removed the go to end of runway to takeoff.
4) Reversed Gate order.

Gate Order:
From: To:
3,2,1 1,2,3
6,5,4 4,5,6

Only one code change, and that was to restrict hangar to terminal and landing to terminal to be controlled.

Known issues:
OpenTTD splash page uses an International Airport, planes will be a bit confused. (If anyone knows how to change that splash page stuff, let me know.)

The changes are applied to 3 files.
aircraft_cmd.cpp, airport.h, airport_movement.h

While I have been working with version 25493, it should work with newer builds without any issues.
(I like the Daylength patch and that is their latest.)

Start a new game with this... Because the states for this airport are completely different, it will probably crash if you load a saved game.
If you want to try and convert a saved game... Here are the steps:
1) Open game with current patches. Close all International airports. Make sure all planes are in the air or other airports.
2) Apply patch.
3) When you come in, all the planes will be acting wierd around International Airports. Don't do anything with them!!
4) Delete airport and apply a new International Airport. (resets planes orders.)

You could also switch all International airports to other ones, and then switch back after applying patch.

Anyway, let me know what you think. And now that I have this down... maybe we can get some new airports in... :D
Attachments
International_Airport_State_Machine_r25493.patch
(25.1 KiB) Downloaded 97 times

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4754
Joined: 09 Sep 2007 05:03
Location: home

Re: [Patch] International Airport State Machine Optimization

Post by Alberth »

Vetteman06 wrote:OpenTTD splash page uses an International Airport, planes will be a bit confused. (If anyone knows how to change that splash page stuff, let me know.)
Bump the savegame version, and add a conversion in AfterLoad() from the old to the new situation.

Any game loaded goes through this function, and upgrades the game state to your new situation. It also means you can load 'old'games, and continue playing with your patched version.
Vetteman06 wrote:maybe we can get some new airports in... :D
The current intended direction for airports is to move the statemachine into NewGRF. Together with the graphics (which afaik are already supported by NewGRF), it would allow arbitrarily many[*] (newgrf) airports.

[*] Until you run out of NewGRF slots.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests