OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Member Functions | Data Fields | Private Member Functions
Airport Struct Reference

All airport-related information. More...

`#include <station_base.h>`

Inheritance diagram for Airport:

## 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.
bool | HasHangar () const
| Check if this airport has at least one hangar.
TileIndex | GetRotatedTileFromOffset (TileIndexDiffC tidc) const
| Add the tileoffset to the base tile of this airport but rotate it first.
TileIndex | GetHangarTile (uint hangar_num) const
| Get the first tile of the given hangar.
Direction | GetHangarExitDirection (TileIndex tile) const
| Get the exit direction of the hangar at a specific tile.
uint | GetHangarNum (TileIndex tile) const
| Get the hangar number of the hangar at a specific tile.
uint | GetNumHangars () const
| Get the number of hangars on this airport.
Public Member Functions inherited from OrthogonalTileArea
| OrthogonalTileArea (TileIndex tile=INVALID_TILE, uint8 w=0, uint8 h=0)
| Construct this tile area with some set values.
| OrthogonalTileArea (TileIndex start, TileIndex end)
| Construct this tile area based on two points.
void | Add (TileIndex to_add)
| Add a single tile to a tile area; enlarge if needed.
void | Clear ()
| Clears the 'tile area', i.e.
bool | Intersects (const OrthogonalTileArea &ta) const
| Does this tile area intersect with another?
bool | Contains (TileIndex tile) const
| Does this tile area contain a tile?
void | ClampToMap ()
| Clamp the tile area to map borders.
TileIndex | GetCenterTile () const
| Get the center tile.

## 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.
DirectionByte | rotation
| How this airport is rotated.
PersistentStorage * | psa
| Persistent storage for NewGRF airports.
Data Fields inherited from OrthogonalTileArea
TileIndex | tile
| The base tile of the area.
uint16 | w
| The width of the area.
uint16 | h
| The height of the area.

## Private Member Functions
const HangarTileTable * | GetHangarDataByTile (TileIndex tile) const
| Retrieve hangar information of a hangar at a given tile.

## Detailed Description

All airport-related information.

Only valid if tile != INVALID_TILE.

Definition at line 305 of file station_base.h.

## Member Function Documentation

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.

Precondition
  this->type < NEW_AIRPORT_OFFSET.

Returns
  The state machine for this airport.

Definition at line 332 of file station_base.h.

References AirportSpec::fsm, and GetSpec().

Referenced by AircraftController(), AircraftNextAirportPos_and_Order(), CanVehicleUseStation(), CheckOrders(), FindNearestHangar(), FloodVehicleProc(), GetVehiclePosOnBuild(), MapAircraftMovementState(), MaybeCrashAirplane(), Vehicle::PreDestructor(), and UpdateAirplanesOnNewStation().

const HangarTileTable* Airport::GetHangarDataByTile | ( | TileIndex | tile | ) | const
| inline private

Retrieve hangar information of a hangar at a given tile.

Parameters

  tile | Tile containing the hangar.

Returns
  The requested hangar information.

Precondition
  The tile must be at a hangar tile at an airport.

Definition at line 431 of file station_base.h.

References AirportSpec::depot_table, GetRotatedTileFromOffset(), GetSpec(), AirportSpec::nof_depots, and HangarTileTable::ti.

Referenced by GetHangarExitDirection(), and GetHangarNum().

Direction Airport::GetHangarExitDirection | ( | TileIndex | tile | ) | const
| inline

Get the exit direction of the hangar at a specific tile.

Parameters

  tile | The tile to query.

Precondition
  IsHangarTile(tile).

Returns
  The exit direction of the hangar, taking airport rotation into account.

Definition at line 390 of file station_base.h.

References ChangeDir(), HangarTileTable::dir, DirDifference(), GetHangarDataByTile(), GetSpec(), AirportSpec::rotation, and rotation.

Referenced by AircraftEventHandler_InHangar().

uint Airport::GetHangarNum | ( | TileIndex | tile | ) | const
| inline

Get the hangar number of the hangar at a specific tile.

Parameters

  tile | The tile to query.

Precondition
  IsHangarTile(tile).

Returns
  The hangar number of the hangar at the given tile.

Definition at line 403 of file station_base.h.

References GetHangarDataByTile(), and HangarTileTable::hangar_num.

Referenced by CmdBuildAircraft().

TileIndex Airport::GetHangarTile | ( | uint | hangar_num | ) | const
| inline

Get the first tile of the given hangar.

Parameters

  hangar_num | The hangar to get the location of.

Precondition
  hangar_num < GetNumHangars().

Returns
  A tile with the given hangar.

Definition at line 373 of file station_base.h.

References AirportSpec::depot_table, GetRotatedTileFromOffset(), GetSpec(), HangarTileTable::hangar_num, AirportSpec::nof_depots, and HangarTileTable::ti.

Referenced by CmdBuildAircraft(), GetVehiclePosOnBuild(), IsHangar(), and RemoveAirport().

uint Airport::GetNumHangars | ( |  | ) | const
| inline

Get the number of hangars on this airport.

Definition at line 410 of file station_base.h.

References AirportSpec::depot_table, GetSpec(), HangarTileTable::hangar_num, HasBit(), AirportSpec::nof_depots, and SetBit().

Referenced by RemoveAirport().

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.

Parameters

  tidc | The tilediff to add to the airport tile.

Returns
  The tile of this airport plus the rotated offset.

Definition at line 351 of file station_base.h.

References DIR_E, DIR_N, DIR_S, DIR_W, GetSpec(), rotation, AirportSpec::size_x, AirportSpec::size_y, OrthogonalTileArea::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.

Returns
  The AirportSpec for this airport.

Definition at line 320 of file station_base.h.

References AirportSpec::dummy, AirportSpec::Get(), INVALID_TILE, OrthogonalTileArea::tile, and type.

Referenced by AfterLoadGame(), AirportMaintenanceCost(), GetFTA(), GetHangarDataByTile(), GetHangarExitDirection(), GetHangarTile(), GetNumHangars(), GetRotatedTileFromOffset(), HasHangar(), IsHangar(), RemoveAirport(), and UpdateAirportsNoise().

bool Airport::HasHangar | ( |  | ) | const
| inline

Check if this airport has at least one hangar.

Definition at line 338 of file station_base.h.

References GetSpec(), and AirportSpec::nof_depots.

Referenced by AircraftEventHandler_AtTerminal(), CmdInsertOrder(), Aircraft::FindClosestDepot(), and FindNearestHangar().

## Field Documentation

byte Airport::type

Type of this airport,.

See Also
  AirportTypes

Definition at line 309 of file station_base.h.

Referenced by AfterLoadGame(), AircraftController(), AirportTileScopeResolver::AirportTileScopeResolver(), CmdBuildAirport(), CmdDeleteTown(), Disaster_Zeppeliner_Init(), GetSpec(), UpdateAirportsNoise(), and Station::UpdateVirtCoord().

The documentation for this struct was generated from the following file:

- src/station_base.h