#include <ai_airport.hpp>
Public Types | |
enum | AirportType { AT_SMALL = 0, AT_LARGE = 1, AT_METROPOLITAN = 3, AT_INTERNATIONAL = 4, AT_COMMUTER = 5, AT_INTERCON = 7, AT_HELIPORT = 2, AT_HELISTATION = 8, AT_HELIDEPOT = 6, AT_INVALID = 255 } |
The types of airports available in the game. More... | |
enum | PlaneType { PT_HELICOPTER = 0, PT_SMALL_PLANE = 1, PT_BIG_PLANE = 3, PT_INVALID = -1 } |
All plane types available. More... | |
Static Public Member Functions | |
static const char * | GetClassName () |
static bool | IsValidAirportType (AirportType type) |
Checks whether the given AirportType is valid and available. | |
static Money | GetPrice (AirportType type) |
Get the cost to build this AirportType. | |
static bool | IsHangarTile (TileIndex tile) |
Checks whether the given tile is actually a tile with a hangar. | |
static bool | IsAirportTile (TileIndex tile) |
Checks whether the given tile is actually a tile with an airport. | |
static int32 | GetAirportWidth (AirportType type) |
Get the width of this type of airport. | |
static int32 | GetAirportHeight (AirportType type) |
Get the height of this type of airport. | |
static int32 | GetAirportCoverageRadius (AirportType type) |
Get the coverage radius of this type of airport. | |
static int32 | GetNumHangars (TileIndex tile) |
Get the number of hangars of the airport. | |
static TileIndex | GetHangarOfAirport (TileIndex tile) |
Get the first hanger tile of the airport. | |
static bool | BuildAirport (TileIndex tile, AirportType type, StationID station_id) |
Builds a airport with tile at the topleft corner. | |
static bool | RemoveAirport (TileIndex tile) |
Removes an airport. | |
static AirportType | GetAirportType (TileIndex tile) |
Get the AirportType of an existing airport. | |
static int | GetNoiseLevelIncrease (TileIndex tile, AirportType type) |
Get the noise that will be added to the nearest town if an airport was built at this tile. | |
static TownID | GetNearestTown (TileIndex tile, AirportType type) |
Get the TownID of the town whose local authority will influence an airport at some tile. |
Definition at line 13 of file ai_airport.hpp.
The types of airports available in the game.
Definition at line 20 of file ai_airport.hpp.
enum AIAirport::PlaneType |
All plane types available.
PT_HELICOPTER | A helicopter. |
PT_SMALL_PLANE | A small plane. |
PT_BIG_PLANE | A big plane. |
PT_INVALID | An invalid PlaneType. |
Definition at line 40 of file ai_airport.hpp.
bool AIAirport::IsValidAirportType | ( | AirportType | type | ) | [static] |
Checks whether the given AirportType is valid and available.
type | The AirportType to check. |
Definition at line 13 of file ai_airport.cpp.
References AT_HELISTATION, AT_SMALL, GetValidAirports(), and HasBit().
Referenced by BuildAirport(), GetAirportCoverageRadius(), GetAirportHeight(), GetAirportWidth(), GetNearestTown(), GetNoiseLevelIncrease(), and GetPrice().
Money AIAirport::GetPrice | ( | AirportType | type | ) | [static] |
Get the cost to build this AirportType.
type | The AirportType to check. |
Definition at line 18 of file ai_airport.cpp.
References IsValidAirportType(), AirportFTAClass::size_x, and AirportFTAClass::size_y.
bool AIAirport::IsHangarTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a hangar.
tile | The tile to check. |
Definition at line 26 of file ai_airport.cpp.
References IsHangar(), IsTileType(), IsValidTile(), and MP_STATION.
Referenced by RemoveAirport().
bool AIAirport::IsAirportTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with an airport.
tile | The tile to check. |
Definition at line 33 of file ai_airport.cpp.
References IsTileType(), IsValidTile(), and MP_STATION.
Referenced by RemoveAirport().
int32 AIAirport::GetAirportWidth | ( | AirportType | type | ) | [static] |
Get the width of this type of airport.
type | The type of airport. |
Definition at line 40 of file ai_airport.cpp.
References IsValidAirportType().
int32 AIAirport::GetAirportHeight | ( | AirportType | type | ) | [static] |
Get the height of this type of airport.
type | The type of airport. |
Definition at line 47 of file ai_airport.cpp.
References IsValidAirportType().
int32 AIAirport::GetAirportCoverageRadius | ( | AirportType | type | ) | [static] |
Get the coverage radius of this type of airport.
type | The type of airport. |
Definition at line 54 of file ai_airport.cpp.
References _settings_game, CA_UNMODIFIED, IsValidAirportType(), StationSettings::modified_catchment, and GameSettings::station.
int32 AIAirport::GetNumHangars | ( | TileIndex | tile | ) | [static] |
Get the number of hangars of the airport.
tile | Any tile of the airport. |
Definition at line 80 of file ai_airport.cpp.
References Station::Airport(), Station::facilities, IsTileType(), IsValidTile(), MP_STATION, AirportFTAClass::nof_depots, and Station::owner.
Referenced by GetHangarOfAirport().
Get the first hanger tile of the airport.
tile | Any tile of the airport. |
GetNumHangars(tile) > 0.
Definition at line 92 of file ai_airport.cpp.
References Station::Airport(), AirportFTAClass::airport_depots, Station::airport_tile, Station::facilities, GetNumHangars(), INVALID_TILE, IsTileType(), IsValidTile(), MP_STATION, Station::owner, and ToTileIndexDiff().
bool AIAirport::BuildAirport | ( | TileIndex | tile, | |
AirportType | type, | |||
StationID | station_id | |||
) | [static] |
Builds a airport with tile at the topleft corner.
tile | The topleft corner of the airport. | |
type | The type of airport to build. | |
station_id | The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT. |
AirportAvailable(type).
station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
AIError::ERR_AREA_NOT_CLEAR | ||
AIError::ERR_FLAT_LAND_REQUIRED | ||
AIError::ERR_LOCAL_AUTHORITY_REFUSES | ||
AIStation::ERR_STATION_TOO_LARGE | ||
AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION |
Definition at line 61 of file ai_airport.cpp.
References CMD_BUILD_AIRPORT, AIObject::DoCommand(), EnforcePrecondition, IsValidAirportType(), AIStation::IsValidStation(), IsValidTile(), AIStation::STATION_JOIN_ADJACENT, and AIStation::STATION_NEW.
bool AIAirport::RemoveAirport | ( | TileIndex | tile | ) | [static] |
Removes an airport.
tile | Any tile of the airport. |
AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
Definition at line 72 of file ai_airport.cpp.
References CMD_LANDSCAPE_CLEAR, AIObject::DoCommand(), EnforcePrecondition, IsAirportTile(), IsHangarTile(), and IsValidTile().
AIAirport::AirportType AIAirport::GetAirportType | ( | TileIndex | tile | ) | [static] |
Get the AirportType of an existing airport.
tile | Any tile of the airport. |
AIStation::HasStationType(AIStation.GetStationID(tile), AIStation::STATION_AIRPORT).
Definition at line 105 of file ai_airport.cpp.
References AT_INVALID, GetStationIndex(), AIStation::HasStationType(), AITile::IsStationTile(), and AIStation::STATION_AIRPORT.
int AIAirport::GetNoiseLevelIncrease | ( | TileIndex | tile, | |
AirportType | type | |||
) | [static] |
Get the noise that will be added to the nearest town if an airport was built at this tile.
tile | The tile to check. | |
type | The AirportType to check. |
Definition at line 117 of file ai_airport.cpp.
References _settings_game, AirportGetNearestTown(), GameSettings::economy, GetAirportNoiseLevelForTown(), IsValidAirportType(), IsValidTile(), and EconomySettings::station_noise_level.
TownID AIAirport::GetNearestTown | ( | TileIndex | tile, | |
AirportType | type | |||
) | [static] |
Get the TownID of the town whose local authority will influence an airport at some tile.
tile | The tile to check. | |
type | The AirportType to check. |
Definition at line 134 of file ai_airport.cpp.
References AirportGetNearestTown(), IsValidAirportType(), and IsValidTile().