Public Types | Static Public Member Functions

ScriptBaseStation Class Reference

Base class for stations and waypoints. More...

#include <script_basestation.hpp>

Inheritance diagram for ScriptBaseStation:
ScriptObject SimpleCountedObject ScriptStation ScriptWaypoint

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 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, Text *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.

Detailed Description

Base class for stations and waypoints.

ai game

Definition at line 22 of file script_basestation.hpp.


Member Enumeration Documentation

Special station IDs for building adjacent/new stations when the adjacent/distant join features are enabled.

Enumerator:
STATION_NEW 

Build a new station.

STATION_JOIN_ADJACENT 

Join an neighbouring station if one exists.

STATION_INVALID 

Invalid station id.

Definition at line 28 of file script_basestation.hpp.


Member Function Documentation

int32 ScriptBaseStation::GetConstructionDate ( StationID  station_id  )  [static]

Get the last date a station part was added to this station.

Parameters:
station_id The station to look at.
Returns:
The last date some part of this station was build.

Definition at line 58 of file script_basestation.cpp.

References IsValidBaseStation().

TileIndex ScriptBaseStation::GetLocation ( StationID  station_id  )  [static]

Get the current location of a basestation.

Parameters:
station_id The basestation to get the location of.
Precondition:
IsValidBaseStation(station_id).
Returns:
The tile the basestation sign above it.
Note:
The tile is not necessarily a station tile (and if it is, it could also belong to another station).
See also:
ScriptTileList_StationType.

Definition at line 51 of file script_basestation.cpp.

References INVALID_TILE, and IsValidBaseStation().

Referenced by ScriptStation::GetDistanceManhattanToTile(), ScriptStation::GetDistanceSquareToTile(), and ScriptStation::IsWithinTownInfluence().

char * ScriptBaseStation::GetName ( StationID  station_id  )  [static]

Get the name of a basestation.

Parameters:
station_id The basestation to get the name of.
Precondition:
IsValidBaseStation(station_id).
Returns:
The name of the station.

Definition at line 25 of file script_basestation.cpp.

References IsValidBaseStation(), and SetDParam().

bool ScriptBaseStation::IsValidBaseStation ( StationID  station_id  )  [static]

Checks whether the given basestation is valid and owned by you.

Parameters:
station_id The station to check.
Returns:
True if and only if the basestation is valid.
Note:
IsValidBaseStation == (IsValidStation || IsValidWaypoint).

Definition at line 19 of file script_basestation.cpp.

References ScriptObject::GetCompany(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::GetIfValid(), BaseStation::owner, and OWNER_DEITY.

Referenced by GetConstructionDate(), GetLocation(), GetName(), ScriptVehicleList_Station::ScriptVehicleList_Station(), and SetName().

bool ScriptBaseStation::SetName ( StationID  station_id,
Text name 
) [static]

Set the name this basestation.

Parameters:
station_id The basestation to set the name of.
name The new name of the station (can be either a raw string, or a ScriptText object).
Precondition:
IsValidBaseStation(station_id).
name != NULL && len(name) != 0.
Valid ScriptCompanyMode active in scope.
Exceptions:
ScriptError::ERR_NAME_IS_NOT_UNIQUE 
Returns:
True if the name was changed.

Definition at line 37 of file script_basestation.cpp.

References CMD_RENAME_STATION, CMD_RENAME_WAYPOINT, ScriptObject::DoCommand(), EnforcePrecondition, EnforcePreconditionCustomError, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG, ScriptObject::GetCompany(), Text::GetEncodedText(), IsValidBaseStation(), MAX_LENGTH_STATION_NAME_CHARS, OWNER_DEITY, StrEmpty(), and Utf8StringLength().


The documentation for this class was generated from the following files: