Class that handles all airport related functions. More...
#include <script_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 bool | IsValidAirportType (AirportType type) |
Checks whether the given AirportType is valid and available. | |
static bool | IsAirportInformationAvailable (AirportType type) |
Can you get information on this airport type? As opposed to IsValidAirportType this will return also return true when an airport type is no longer buildable. | |
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. | |
static uint16 | GetMaintenanceCostFactor (AirportType type) |
Get the maintenance cost factor of an airport type. |
Class that handles all airport related functions.
ai
Definition at line 21 of file script_airport.hpp.
The types of airports available in the game.
Definition at line 26 of file script_airport.hpp.
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 46 of file script_airport.hpp.
bool ScriptAirport::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, ScriptStation::STATION_NEW or ScriptStation::STATION_JOIN_ADJACENT. |
Definition at line 72 of file script_airport.cpp.
References CMD_BUILD_AIRPORT, ScriptObject::DoCommand(), EnforcePrecondition, IsValidAirportType(), ScriptStation::IsValidStation(), IsValidTile(), ScriptBaseStation::STATION_JOIN_ADJACENT, and ScriptBaseStation::STATION_NEW.
int32 ScriptAirport::GetAirportCoverageRadius | ( | AirportType | type | ) | [static] |
Get the coverage radius of this type of airport.
type | The type of airport. |
Definition at line 65 of file script_airport.cpp.
References _settings_game, AirportSpec::Get(), IsAirportInformationAvailable(), StationSettings::modified_catchment, and GameSettings::station.
int32 ScriptAirport::GetAirportHeight | ( | AirportType | type | ) | [static] |
Get the height of this type of airport.
type | The type of airport. |
Definition at line 58 of file script_airport.cpp.
References IsAirportInformationAvailable().
ScriptAirport::AirportType ScriptAirport::GetAirportType | ( | TileIndex | tile | ) | [static] |
Get the AirportType of an existing airport.
tile | Any tile of the airport. |
Definition at line 116 of file script_airport.cpp.
References AT_INVALID, SpecializedStation< Station, false >::Get(), GetStationIndex(), ScriptStation::HasStationType(), ScriptTile::IsStationTile(), and ScriptStation::STATION_AIRPORT.
int32 ScriptAirport::GetAirportWidth | ( | AirportType | type | ) | [static] |
Get the width of this type of airport.
type | The type of airport. |
Definition at line 51 of file script_airport.cpp.
References IsAirportInformationAvailable().
Get the first hanger tile of the airport.
tile | Any tile of the airport. |
Definition at line 103 of file script_airport.cpp.
References _current_company, Station::airport, FACIL_AIRPORT, BaseStation::facilities, SpecializedStation< Station, false >::GetByTile(), Airport::GetHangarTile(), GetNumHangars(), INVALID_TILE, IsTileType(), IsValidTile(), MP_STATION, and BaseStation::owner.
uint16 ScriptAirport::GetMaintenanceCostFactor | ( | AirportType | type | ) | [static] |
Get the maintenance cost factor of an airport type.
type | The airport type to get the maintenance factor of. |
Definition at line 157 of file script_airport.cpp.
References AirportSpec::Get(), IsAirportInformationAvailable(), and AirportSpec::maintenance_cost.
TownID ScriptAirport::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 146 of file script_airport.cpp.
References AirportGetNearestTown(), AirportSpec::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsAirportInformationAvailable(), IsValidTile(), and AirportSpec::table.
int ScriptAirport::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 128 of file script_airport.cpp.
References _settings_game, AirportGetNearestTown(), GameSettings::economy, AirportSpec::Get(), GetAirportNoiseLevelForTown(), IsAirportInformationAvailable(), IsValidTile(), EconomySettings::station_noise_level, AirportSpec::table, and Town::xy.
int32 ScriptAirport::GetNumHangars | ( | TileIndex | tile | ) | [static] |
Get the number of hangars of the airport.
tile | Any tile of the airport. |
Definition at line 91 of file script_airport.cpp.
References _current_company, Station::airport, FACIL_AIRPORT, BaseStation::facilities, SpecializedStation< Station, false >::GetByTile(), Airport::GetNumHangars(), IsTileType(), IsValidTile(), MP_STATION, and BaseStation::owner.
Referenced by GetHangarOfAirport().
Money ScriptAirport::GetPrice | ( | AirportType | type | ) | [static] |
Get the cost to build this AirportType.
type | The AirportType to check. |
Definition at line 29 of file script_airport.cpp.
References AirportSpec::Get(), IsValidAirportType(), AirportSpec::size_x, and AirportSpec::size_y.
bool ScriptAirport::IsAirportInformationAvailable | ( | AirportType | type | ) | [static] |
Can you get information on this airport type? As opposed to IsValidAirportType this will return also return true when an airport type is no longer buildable.
type | The AirportType to check. |
Definition at line 24 of file script_airport.cpp.
References AirportSpec::enabled, AirportSpec::Get(), and NUM_AIRPORTS.
Referenced by GetAirportCoverageRadius(), GetAirportHeight(), GetAirportWidth(), GetMaintenanceCostFactor(), GetNearestTown(), GetNoiseLevelIncrease(), and IsValidAirportType().
bool ScriptAirport::IsAirportTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with an airport.
tile | The tile to check. |
Definition at line 44 of file script_airport.cpp.
References IsAirport(), IsTileType(), IsValidTile(), and MP_STATION.
Referenced by RemoveAirport().
bool ScriptAirport::IsHangarTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a tile with a hangar.
tile | The tile to check. |
Definition at line 37 of file script_airport.cpp.
References IsHangar(), IsTileType(), IsValidTile(), and MP_STATION.
Referenced by RemoveAirport().
bool ScriptAirport::IsValidAirportType | ( | AirportType | type | ) | [static] |
Checks whether the given AirportType is valid and available.
type | The AirportType to check. |
Definition at line 19 of file script_airport.cpp.
References AirportSpec::Get(), and IsAirportInformationAvailable().
Referenced by BuildAirport(), and GetPrice().
bool ScriptAirport::RemoveAirport | ( | TileIndex | tile | ) | [static] |
Removes an airport.
tile | Any tile of the airport. |
ScriptError::ERR_OWNED_BY_ANOTHER_COMPANY |
Definition at line 83 of file script_airport.cpp.
References CMD_LANDSCAPE_CLEAR, ScriptObject::DoCommand(), EnforcePrecondition, IsAirportTile(), IsHangarTile(), and IsValidTile().