Base class for stations and waypoints. More...
#include <ai_basestation.hpp>
Public Types | |
enum | SpecialStationIDs { STATION_NEW = 0xFFFD, STATION_JOIN_ADJACENT = 0xFFFE, STATION_INVALID = 0xFFFF } |
Special station IDs for building adjacent/new stations when the adjacent/distant join features are enabled. More... | |
Static Public Member Functions | |
static const char * | GetClassName () |
Get the name of this class to identify it towards squirrel. | |
static bool | IsValidBaseStation (StationID station_id) |
Checks whether the given basestation is valid and owned by you. | |
static char * | GetName (StationID station_id) |
Get the name of a basestation. | |
static bool | SetName (StationID station_id, const char *name) |
Set the name this basestation. | |
static TileIndex | GetLocation (StationID station_id) |
Get the current location of a basestation. | |
static int32 | GetConstructionDate (StationID station_id) |
Get the last date a station part was added to this station. |
Base class for stations and waypoints.
Definition at line 21 of file ai_basestation.hpp.
Special station IDs for building adjacent/new stations when the adjacent/distant join features are enabled.
STATION_NEW |
Build a new station. |
STATION_JOIN_ADJACENT |
Join an neighbouring station if one exists. |
STATION_INVALID |
Invalid station id. |
Definition at line 30 of file ai_basestation.hpp.
static const char* AIBaseStation::GetClassName | ( | ) | [inline, static] |
Get the name of this class to identify it towards squirrel.
Reimplemented in AIStation, and AIWaypoint.
Definition at line 24 of file ai_basestation.hpp.
int32 AIBaseStation::GetConstructionDate | ( | StationID | station_id | ) | [static] |
Get the last date a station part was added to this station.
station_id | The station to look at. |
Definition at line 53 of file ai_basestation.cpp.
References IsValidBaseStation().
Get the current location of a basestation.
station_id | The basestation to get the location of. |
Definition at line 46 of file ai_basestation.cpp.
References INVALID_TILE, and IsValidBaseStation().
Referenced by AIStation::GetDistanceManhattanToTile(), AIStation::GetDistanceSquareToTile(), and AIStation::IsWithinTownInfluence().
char * AIBaseStation::GetName | ( | StationID | station_id | ) | [static] |
Get the name of a basestation.
station_id | The basestation to get the name of. |
Definition at line 25 of file ai_basestation.cpp.
References IsValidBaseStation(), SpecializedStation< Station, false >::IsValidID(), and SetDParam().
bool AIBaseStation::IsValidBaseStation | ( | StationID | station_id | ) | [static] |
Checks whether the given basestation is valid and owned by you.
station_id | The station to check. |
Definition at line 19 of file ai_basestation.cpp.
References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_station_pool >::GetIfValid(), BaseStation::owner, and OWNER_NONE.
Referenced by AIVehicleList_Station::AIVehicleList_Station(), GetConstructionDate(), GetLocation(), GetName(), and SetName().
bool AIBaseStation::SetName | ( | StationID | station_id, | |
const char * | name | |||
) | [static] |
Set the name this basestation.
station_id | The basestation to set the name of. | |
name | The new name of the station. |
AIError::ERR_NAME_IS_NOT_UNIQUE |
Definition at line 37 of file ai_basestation.cpp.
References CMD_RENAME_STATION, CMD_RENAME_WAYPOINT, AIObject::DoCommand(), EnforcePrecondition, EnforcePreconditionCustomError, AIError::ERR_PRECONDITION_STRING_TOO_LONG, IsValidBaseStation(), SpecializedStation< Station, false >::IsValidID(), MAX_LENGTH_STATION_NAME_CHARS, StrEmpty(), and Utf8StringLength().