OpenTTD GameScript API  20240419-master-g7848e80f71
Public Types | Static Public Member Functions
GSWaypoint Class Reference

Class that handles all waypoint related functions. More...

Inheritance diagram for GSWaypoint:
GSBaseStation

Public Types

enum  ErrorMessages {
  ERR_WAYPOINT_BASE,
  ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT,
  ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS
}
 All waypoint related error messages. More...
 
enum  WaypointType {
  WAYPOINT_RAIL,
  WAYPOINT_BUOY,
  WAYPOINT_ANY
}
 Type of waypoints known in the game. More...
 
- Public Types inherited from GSBaseStation
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 IsValidWaypoint (StationID waypoint_id)
 Checks whether the given waypoint is valid and owned by you. More...
 
static StationID GetWaypointID (TileIndex tile)
 Get the StationID of a tile. More...
 
static bool HasWaypointType (StationID waypoint_id, WaypointType waypoint_type)
 Check if any part of the waypoint contains a waypoint of the type waypoint_type. More...
 
- Static Public Member Functions inherited from GSBaseStation
static bool IsValidBaseStation (StationID station_id)
 Checks whether the given basestation is valid and owned by you. More...
 
static std::optional< std::string > GetName (StationID station_id)
 Get the name of a basestation. More...
 
static bool SetName (StationID station_id, Text *name)
 Set the name this basestation. More...
 
static TileIndex GetLocation (StationID station_id)
 Get the current location of a basestation. More...
 
static GSDate::Date GetConstructionDate (StationID station_id)
 Get the last date a station part was added to this station. More...
 

Detailed Description

Class that handles all waypoint related functions.

Member Enumeration Documentation

◆ ErrorMessages

All waypoint related error messages.

Enumerator
ERR_WAYPOINT_BASE 

Base for waypoint related errors.

ERR_WAYPOINT_TOO_CLOSE_TO_ANOTHER_WAYPOINT 

The waypoint is build too close to another waypoint.

ERR_WAYPOINT_ADJOINS_MULTIPLE_WAYPOINTS 

The waypoint would join more than one existing waypoint together.

◆ WaypointType

Type of waypoints known in the game.

Enumerator
WAYPOINT_RAIL 

Rail waypoint.

WAYPOINT_BUOY 

Buoy.

WAYPOINT_ANY 

All waypoint types.

Member Function Documentation

◆ GetWaypointID()

static StationID GSWaypoint::GetWaypointID ( TileIndex  tile)
static

Get the StationID of a tile.

Parameters
tileThe tile to find the StationID of.
Precondition
GSRail::IsRailWaypointTile(tile).
Returns
StationID of the waypoint.

◆ HasWaypointType()

static bool GSWaypoint::HasWaypointType ( StationID  waypoint_id,
WaypointType  waypoint_type 
)
static

Check if any part of the waypoint contains a waypoint of the type waypoint_type.

Parameters
waypoint_idThe waypoint to look at.
waypoint_typeThe WaypointType to look for.
Returns
True if the waypoint has a waypoint part of the type waypoint_type.

◆ IsValidWaypoint()

static bool GSWaypoint::IsValidWaypoint ( StationID  waypoint_id)
static

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

Parameters
waypoint_idThe waypoint to check.
Returns
True if and only if the waypoint is valid.