All airport-related information. More...
#include <station_base.h>
Public Types | |
typedef PersistentStorageArray < int32, 16 > | PersistentStorage |
Public Member Functions | |
const AirportSpec * | GetSpec () const |
Get the AirportSpec that from the airport type of this airport. | |
const AirportFTAClass * | GetFTA () const |
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in case this isn't an airport. | |
FORCEINLINE bool | HasHangar () const |
Check if this airport has at least one hangar. | |
FORCEINLINE TileIndex | GetRotatedTileFromOffset (TileIndexDiffC tidc) const |
Add the tileoffset to the base tile of this airport but rotate it first. | |
FORCEINLINE TileIndex | GetHangarTile (uint hangar_num) const |
Get the first tile of the given hangar. | |
FORCEINLINE Direction | GetHangarExitDirection (TileIndex tile) const |
Get the exit direction of the hangar at a specific tile. | |
FORCEINLINE uint | GetHangarNum (TileIndex tile) const |
Get the hangar number of the hangar at a specific tile. | |
FORCEINLINE uint | GetNumHangars () const |
Get the number of hangars on this airport. | |
Data Fields | |
uint64 | flags |
stores which blocks on the airport are taken. was 16 bit earlier on, then 32 | |
byte | type |
Type of this airport,. | |
byte | layout |
Airport layout number. | |
Direction | rotation |
How this airport is rotated. | |
PersistentStorage | psa |
Persistent storage for NewGRF airports. | |
Private Member Functions | |
FORCEINLINE const HangarTileTable * | GetHangarDataByTile (TileIndex tile) const |
Retrieve hangar information of a hangar at a given tile. |
All airport-related information.
Only valid if tile != INVALID_TILE.
Definition at line 50 of file station_base.h.
const AirportFTAClass* Airport::GetFTA | ( | ) | const [inline] |
Get the finite-state machine for this airport or the finite-state machine for the dummy airport in case this isn't an airport.
Definition at line 78 of file station_base.h.
References AirportSpec::fsm, and GetSpec().
Referenced by AircraftController(), AircraftNextAirportPos_and_Order(), CanVehicleUseStation(), FindNearestHangar(), FloodVehicleProc(), GetVehiclePosOnBuild(), MapAircraftMovementState(), MaybeCrashAirplane(), Vehicle::PreDestructor(), and UpdateAirplanesOnNewStation().
FORCEINLINE const HangarTileTable* Airport::GetHangarDataByTile | ( | TileIndex | tile | ) | const [inline, private] |
Retrieve hangar information of a hangar at a given tile.
tile | Tile containing the hangar. |
Definition at line 177 of file station_base.h.
References AirportSpec::depot_table, GetRotatedTileFromOffset(), GetSpec(), AirportSpec::nof_depots, and HangarTileTable::ti.
Referenced by GetHangarExitDirection(), and GetHangarNum().
Get the exit direction of the hangar at a specific tile.
tile | The tile to query. |
Definition at line 136 of file station_base.h.
References ChangeDir(), HangarTileTable::dir, DirDifference(), GetHangarDataByTile(), GetSpec(), AirportSpec::rotation, and rotation.
Referenced by AircraftEventHandler_InHangar().
FORCEINLINE uint Airport::GetHangarNum | ( | TileIndex | tile | ) | const [inline] |
Get the hangar number of the hangar at a specific tile.
tile | The tile to query. |
Definition at line 149 of file station_base.h.
References GetHangarDataByTile(), and HangarTileTable::hangar_num.
Referenced by CmdBuildAircraft().
FORCEINLINE TileIndex Airport::GetHangarTile | ( | uint | hangar_num | ) | const [inline] |
Get the first tile of the given hangar.
hangar_num | The hangar to get the location of. |
Definition at line 119 of file station_base.h.
References AirportSpec::depot_table, GetRotatedTileFromOffset(), GetSpec(), HangarTileTable::hangar_num, AirportSpec::nof_depots, and HangarTileTable::ti.
Referenced by AIDepotList::AIDepotList(), CmdBuildAircraft(), AIAirport::GetHangarOfAirport(), GetVehiclePosOnBuild(), IsHangar(), and RemoveAirport().
FORCEINLINE uint Airport::GetNumHangars | ( | ) | const [inline] |
Get the number of hangars on this airport.
Definition at line 156 of file station_base.h.
References AirportSpec::depot_table, GetSpec(), HangarTileTable::hangar_num, HasBit(), AirportSpec::nof_depots, and SetBit().
Referenced by AIDepotList::AIDepotList(), AIAirport::GetNumHangars(), and RemoveAirport().
FORCEINLINE TileIndex Airport::GetRotatedTileFromOffset | ( | TileIndexDiffC | tidc | ) | const [inline] |
Add the tileoffset to the base tile of this airport but rotate it first.
The base tile is the northernmost tile of this airport. This function helps to make sure that getting the tile of a hangar works even for rotated airport layouts without requiring a rotated array of hangar tiles.
tidc | The tilediff to add to the airport tile. |
Definition at line 97 of file station_base.h.
References DIR_E, DIR_N, DIR_S, DIR_W, GetSpec(), rotation, AirportSpec::size_x, AirportSpec::size_y, TileArea::tile, TileDiffXY(), ToTileIndexDiff(), TileIndexDiffC::x, and TileIndexDiffC::y.
Referenced by GetHangarDataByTile(), and GetHangarTile().
const AirportSpec* Airport::GetSpec | ( | ) | const [inline] |
Get the AirportSpec that from the airport type of this airport.
If there is no airport (tile
== INVALID_TILE) then return the dummy AirportSpec.
Definition at line 66 of file station_base.h.
References AirportSpec::Get(), INVALID_TILE, TileArea::tile, and type.
Referenced by AfterLoadGame(), Station::GetCatchmentRadius(), GetFTA(), GetHangarDataByTile(), GetHangarExitDirection(), GetHangarTile(), GetNumHangars(), GetRotatedTileFromOffset(), HasHangar(), IsHangar(), RemoveAirport(), and UpdateAirportsNoise().
FORCEINLINE bool Airport::HasHangar | ( | ) | const [inline] |
Check if this airport has at least one hangar.
Definition at line 84 of file station_base.h.
References GetSpec(), and AirportSpec::nof_depots.
Referenced by AircraftEventHandler_AtTerminal(), CmdInsertOrder(), Aircraft::FindClosestDepot(), and FindNearestHangar().
byte Airport::type |
Type of this airport,.
Definition at line 56 of file station_base.h.
Referenced by AfterLoadGame(), AircraftController(), CmdBuildAirport(), CmdDeleteTown(), Disaster_Zeppeliner_Init(), AITown::GetAllowedNoise(), GetSpec(), and Station::UpdateVirtCoord().