OpenTTD GameScript API 20250222-master-g9a8d9e4e48
Static Public Member Functions | Static Public Attributes
GSBaseStation Class Reference

Base class for stations and waypoints. More...

#include <script_basestation.hpp>

Inheritance diagram for GSBaseStation:
GSStation GSWaypoint

Static Public Member Functions

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 GSDate::Date GetConstructionDate (StationID station_id)
 Get the last calendar-date a station part was added to this station.
 

Static Public Attributes

static constexpr StationID STATION_NEW = ::NEW_STATION
 Build a new station.
 
static constexpr StationID STATION_JOIN_ADJACENT = ::ADJACENT_STATION
 Join an neighbouring station if one exists.
 
static constexpr StationID STATION_INVALID = ::StationID::Invalid()
 Invalid station id.
 

Detailed Description

Base class for stations and waypoints.

Member Function Documentation

◆ GetConstructionDate()

static GSDate::Date GSBaseStation::GetConstructionDate ( StationID  station_id)
static

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

Parameters
station_idThe station to look at.
Returns
The last calendar-date some part of this station was build.
See also
GSCalendarTime

◆ GetLocation()

static TileIndex GSBaseStation::GetLocation ( StationID  station_id)
static

Get the current location of a basestation.

Parameters
station_idThe 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
GSTileList_StationType.

◆ GetName()

static string GSBaseStation::GetName ( StationID  station_id)
static

Get the name of a basestation.

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

◆ IsValidBaseStation()

static bool GSBaseStation::IsValidBaseStation ( StationID  station_id)
static

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

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

◆ SetName()

static bool GSBaseStation::SetName ( StationID  station_id,
Text *  name 
)
static

Set the name this basestation.

Parameters
station_idThe basestation to set the name of.
nameThe new name of the station (can be either a raw string, or a GSText object).
Precondition
IsValidBaseStation(station_id).
name != null && len(name) != 0.
GSCompanyMode::IsValid().
Exceptions
GSError::ERR_NAME_IS_NOT_UNIQUE
Returns
True if the name was changed.