OpenTTD AI API 20241230-master-g3a05978cc4
|
Class that handles all station related functions. More...
#include <script_station.hpp>
Public Types | |
enum | ErrorMessages { ERR_STATION_BASE , ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION , ERR_STATION_TOO_MANY_STATIONS , ERR_STATION_TOO_MANY_STATIONS_IN_TOWN } |
All station related error messages. More... | |
enum | StationType { STATION_TRAIN , STATION_TRUCK_STOP , STATION_BUS_STOP , STATION_AIRPORT , STATION_DOCK , STATION_ANY } |
Type of stations known in the game. More... | |
Public Types inherited from AIBaseStation | |
enum | SpecialStationIDs { STATION_NEW , STATION_JOIN_ADJACENT , STATION_INVALID } |
Special station IDs for building adjacent/new stations when the adjacent/distant join features are enabled. More... | |
Static Public Member Functions | |
static bool | IsValidStation (StationID station_id) |
Checks whether the given station is valid and owned by you. | |
static StationID | GetStationID (TileIndex tile) |
Get the StationID of a tile, if there is a station. | |
static int | GetCargoWaiting (StationID station_id, CargoID cargo_id) |
See how much cargo there is waiting on a station. | |
static int | GetCargoWaitingFrom (StationID station_id, StationID from_station_id, CargoID cargo_id) |
See how much cargo with a specific source station there is waiting on a station. | |
static int | GetCargoWaitingVia (StationID station_id, StationID via_station_id, CargoID cargo_id) |
See how much cargo with a specific via-station there is waiting on a station. | |
static int | GetCargoWaitingFromVia (StationID station_id, StationID from_station_id, StationID via_station_id, CargoID cargo_id) |
See how much cargo with a specific via-station and source station there is waiting on a station. | |
static int | GetCargoPlanned (StationID station_id, CargoID cargo_id) |
See how much cargo was planned to pass (including production and consumption) this station per month. | |
static int | GetCargoPlannedFrom (StationID station_id, StationID from_station_id, CargoID cargo_id) |
See how much cargo from the specified origin was planned to pass (including production and consumption) this station per month. | |
static int | GetCargoPlannedVia (StationID station_id, StationID via_station_id, CargoID cargo_id) |
See how much cargo was planned to pass (including production and consumption) this station per month, heading for the specified next hop. | |
static int | GetCargoPlannedFromVia (StationID station_id, StationID from_station_id, StationID via_station_id, CargoID cargo_id) |
See how much cargo from the specified origin was planned to pass this station per month, heading for the specified next hop. | |
static bool | HasCargoRating (StationID station_id, CargoID cargo_id) |
Check whether the given cargo at the given station a rating. | |
static int | GetCargoRating (StationID station_id, CargoID cargo_id) |
See how high the rating is of a cargo on a station. | |
static int | GetCoverageRadius (AIStation::StationType station_type) |
Get the coverage radius of this type of station. | |
static int | GetStationCoverageRadius (StationID station_id) |
Get the coverage radius of this station. | |
static int | GetDistanceManhattanToTile (StationID station_id, TileIndex tile) |
Get the manhattan distance from the tile to the AIStation::GetLocation() of the station. | |
static int | GetDistanceSquareToTile (StationID station_id, TileIndex tile) |
Get the square distance from the tile to the AIStation::GetLocation() of the station. | |
static bool | IsWithinTownInfluence (StationID station_id, TownID town_id) |
Find out if this station is within the rating influence of a town. | |
static bool | HasStationType (StationID station_id, StationType station_type) |
Check if any part of the station contains a station of the type StationType. | |
static bool | HasRoadType (StationID station_id, AIRoad::RoadType road_type) |
Check if any part of the station contains a station of the type RoadType. | |
static TownID | GetNearestTown (StationID station_id) |
Get the town that was nearest to the given station when the station was built. | |
static bool | IsAirportClosed (StationID station_id) |
Get the open/closed state of an airport. | |
static bool | OpenCloseAirport (StationID station_id) |
Toggle the open/closed state of an airport. | |
Static Public Member Functions inherited from AIBaseStation | |
static bool | IsValidBaseStation (StationID station_id) |
Checks whether the given basestation is valid and owned by you. | |
static string | GetName (StationID station_id) |
Get the name of a basestation. | |
static bool | SetName (StationID station_id, Text *name) |
Set the name this basestation. | |
static TileIndex | GetLocation (StationID station_id) |
Get the current location of a basestation. | |
static AIDate::Date | GetConstructionDate (StationID station_id) |
Get the last calendar-date a station part was added to this station. | |
Class that handles all station related functions.
All station related error messages.
See how much cargo was planned to pass (including production and consumption) this station per month.
station_id | The station to get the planned flow for. |
cargo_id | The cargo type to get the planned flow for. |
|
static |
See how much cargo from the specified origin was planned to pass (including production and consumption) this station per month.
station_id | The station to get the planned flow for. |
from_station_id | The station the cargo originates at. |
cargo_id | The cargo type to get the planned flow for. |
|
static |
See how much cargo from the specified origin was planned to pass this station per month, heading for the specified next hop.
station_id | The station to get the planned flow for. |
from_station_id | The station the cargo originates at. |
via_station_id | The next station the cargo will go on to. |
cargo_id | The cargo type to get the planned flow for. |
|
static |
See how much cargo was planned to pass (including production and consumption) this station per month, heading for the specified next hop.
station_id | The station to get the planned flow for. |
via_station_id | The next station the cargo will go on to. |
cargo_id | The cargo type to get the planned flow for. |
See how high the rating is of a cargo on a station.
station_id | The station to get the cargo-rating of. |
cargo_id | The cargo to get the cargo-rating of. |
See how much cargo there is waiting on a station.
station_id | The station to get the cargo-waiting of. |
cargo_id | The cargo to get the cargo-waiting of. |
|
static |
See how much cargo with a specific source station there is waiting on a station.
station_id | The station to get the cargo-waiting of. |
from_station_id | The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted. |
cargo_id | The cargo to get the cargo-waiting of. |
|
static |
See how much cargo with a specific via-station and source station there is waiting on a station.
station_id | The station to get the cargo-waiting of. |
from_station_id | The source station of the cargo. Pass STATION_INVALID to get cargo of which the source has been deleted. |
via_station_id | The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station". |
cargo_id | The cargo to get the cargo-waiting of. |
|
static |
See how much cargo with a specific via-station there is waiting on a station.
station_id | The station to get the cargo-waiting of. |
via_station_id | The next station the cargo is going to. Pass STATION_INVALID to get waiting cargo for "via any station". |
cargo_id | The cargo to get the cargo-waiting of. |
|
static |
Get the coverage radius of this type of station.
station_type | The type of station. |
Get the manhattan distance from the tile to the AIStation::GetLocation() of the station.
station_id | The station to get the distance to. |
tile | The tile to get the distance to. |
Get the square distance from the tile to the AIStation::GetLocation() of the station.
station_id | The station to get the distance to. |
tile | The tile to get the distance to. |
Get the town that was nearest to the given station when the station was built.
station_id | The station to look at. |
|
static |
Get the coverage radius of this station.
station_id | The station to get the coverage radius of. |
Get the StationID of a tile, if there is a station.
tile | The tile to find the stationID of |
Check whether the given cargo at the given station a rating.
station_id | The station to get the cargo-rating state of. |
cargo_id | The cargo to get the cargo-rating state of. |
|
static |
Check if any part of the station contains a station of the type RoadType.
station_id | The station to look at. |
road_type | The RoadType to look for. |
|
static |
Check if any part of the station contains a station of the type StationType.
station_id | The station to look at. |
station_type | The StationType to look for. |
|
static |
Get the open/closed state of an airport.
station_id | The airport to look at. |
|
static |
Checks whether the given station is valid and owned by you.
station_id | The station to check. |
Find out if this station is within the rating influence of a town.
The service quality of stations with signs within this radius influences the rating of the town.
station_id | The station to check. |
town_id | The town to check. |
|
static |
Toggle the open/closed state of an airport.
station_id | The airport to modify. |