OpenTTD Source 20250312-master-gcdcc6b491d
station_type.h File Reference

Types related to stations. More...

Go to the source code of this file.

Data Structures

struct  StationCompare
 
class  StationFinder
 Structure contains cached list of stations nearby. More...
 

Typedefs

using StationID = PoolID< uint16_t, struct StationIDTag, 64000, 0xFFFF >
 
using RoadStopID = PoolID< uint16_t, struct RoadStopIDTag, 64000, 0xFFFF >
 
using StationIDStack = SmallStack< StationID::BaseType, StationID::BaseType, StationID::Invalid().base(), 8, StationID::End().base()>
 
using StationFacilities = EnumBitSet< StationFacility, uint8_t >
 
typedef std::set< Station *, StationCompareStationList
 List of stations.
 

Enumerations

enum class  StationType : uint8_t {
  Rail , Airport , Truck , Bus ,
  Oilrig , Dock , Buoy , RailWaypoint ,
  RoadWaypoint , End
}
 Station types. More...
 
enum class  RoadStopType : uint8_t { Bus , Truck , End }
 Types of RoadStops. More...
 
enum class  StationFacility : uint8_t {
  Train = 0 , TruckStop = 1 , BusStop = 2 , Airport = 3 ,
  Dock = 4 , Waypoint = 7
}
 The facilities a station might be having. More...
 
enum  StationHadVehicleOfType : uint8_t {
  HVOT_NONE = 0 , HVOT_TRAIN = 1 << 1 , HVOT_BUS = 1 << 2 , HVOT_TRUCK = 1 << 3 ,
  HVOT_AIRCRAFT = 1 << 4 , HVOT_SHIP = 1 << 5 , HVOT_WAYPOINT = 1 << 6
}
 The vehicles that may have visited a station. More...
 

Variables

static constexpr StationID NEW_STATION {0xFFFD}
 
static constexpr StationID ADJACENT_STATION {0xFFFE}
 
static constexpr StationFacility STATION_FACILITY_GHOST {6}
 Fake 'facility' to allow toggling display of recently-removed station signs.
 
static constexpr uint CA_NONE = 0
 Catchment when the station has no facilities.
 
static constexpr uint CA_BUS = 3
 Catchment for bus stops with "modified catchment" enabled.
 
static constexpr uint CA_TRUCK = 3
 Catchment for truck stops with "modified catchment" enabled.
 
static constexpr uint CA_TRAIN = 4
 Catchment for train stations with "modified catchment" enabled.
 
static constexpr uint CA_DOCK = 5
 Catchment for docks with "modified catchment" enabled.
 
static constexpr uint CA_UNMODIFIED = 4
 Catchment for all stations with "modified catchment" disabled.
 
static constexpr uint MAX_CATCHMENT = 10
 Maximum catchment for airports with "modified catchment" enabled.
 
static const uint MAX_LENGTH_STATION_NAME_CHARS = 32
 The maximum length of a station name in characters including '\0'.
 

Detailed Description

Types related to stations.

Definition in file station_type.h.

Typedef Documentation

◆ RoadStopID

using RoadStopID = PoolID<uint16_t, struct RoadStopIDTag, 64000, 0xFFFF>

Definition at line 21 of file station_type.h.

◆ StationFacilities

Definition at line 61 of file station_type.h.

◆ StationID

using StationID = PoolID<uint16_t, struct StationIDTag, 64000, 0xFFFF>

Definition at line 17 of file station_type.h.

◆ StationIDStack

using StationIDStack = SmallStack<StationID::BaseType, StationID::BaseType, StationID::Invalid().base(), 8, StationID::End().base()>

Definition at line 29 of file station_type.h.

◆ StationList

typedef std::set<Station *, StationCompare> StationList

List of stations.

Definition at line 97 of file station_type.h.

Enumeration Type Documentation

◆ RoadStopType

enum class RoadStopType : uint8_t
strong

Types of RoadStops.

Enumerator
Bus 

A standard stop for buses.

Truck 

A standard stop for trucks.

End 

End of valid types.

Definition at line 46 of file station_type.h.

◆ StationFacility

enum class StationFacility : uint8_t
strong

The facilities a station might be having.

Enumerator
Train 

Station with train station.

TruckStop 

Station with truck stops.

BusStop 

Station with bus stops.

Airport 

Station with an airport.

Dock 

Station with a dock.

Waypoint 

Station is a waypoint.

Definition at line 53 of file station_type.h.

◆ StationHadVehicleOfType

enum StationHadVehicleOfType : uint8_t

The vehicles that may have visited a station.

Enumerator
HVOT_NONE 

Station has seen no vehicles.

HVOT_TRAIN 

Station has seen a train.

HVOT_BUS 

Station has seen a bus.

HVOT_TRUCK 

Station has seen a truck.

HVOT_AIRCRAFT 

Station has seen an aircraft.

HVOT_SHIP 

Station has seen a ship.

HVOT_WAYPOINT 

Station is a waypoint (NewGRF only!)

Definition at line 67 of file station_type.h.

◆ StationType

enum class StationType : uint8_t
strong

Station types.

Definition at line 32 of file station_type.h.

Variable Documentation

◆ ADJACENT_STATION

constexpr StationID ADJACENT_STATION {0xFFFE}
staticconstexpr

Definition at line 19 of file station_type.h.

◆ CA_BUS

constexpr uint CA_BUS = 3
staticconstexpr

Catchment for bus stops with "modified catchment" enabled.

Definition at line 81 of file station_type.h.

Referenced by Station::GetCatchmentRadius(), GetTileCatchmentRadius(), and BuildRoadStationWindow::OnPaint().

◆ CA_DOCK

constexpr uint CA_DOCK = 5
staticconstexpr

Catchment for docks with "modified catchment" enabled.

Definition at line 84 of file station_type.h.

Referenced by Station::GetCatchmentRadius(), GetTileCatchmentRadius(), and BuildDocksStationWindow::OnPaint().

◆ CA_NONE

constexpr uint CA_NONE = 0
staticconstexpr

Catchment when the station has no facilities.

Definition at line 80 of file station_type.h.

Referenced by Station::GetCatchmentRadius(), GetTileCatchmentRadius(), and Station::RecomputeCatchment().

◆ CA_TRAIN

constexpr uint CA_TRAIN = 4
staticconstexpr

Catchment for train stations with "modified catchment" enabled.

Definition at line 83 of file station_type.h.

Referenced by Station::GetCatchmentRadius(), GetTileCatchmentRadius(), and BuildRailStationWindow::OnPaint().

◆ CA_TRUCK

constexpr uint CA_TRUCK = 3
staticconstexpr

Catchment for truck stops with "modified catchment" enabled.

Definition at line 82 of file station_type.h.

Referenced by Station::GetCatchmentRadius(), GetTileCatchmentRadius(), and BuildRoadStationWindow::OnPaint().

◆ CA_UNMODIFIED

constexpr uint CA_UNMODIFIED = 4
staticconstexpr

◆ MAX_CATCHMENT

constexpr uint MAX_CATCHMENT = 10
staticconstexpr

Maximum catchment for airports with "modified catchment" enabled.

Definition at line 88 of file station_type.h.

Referenced by AirportChangeInfo(), and ForAllStationsAroundTiles().

◆ MAX_LENGTH_STATION_NAME_CHARS

const uint MAX_LENGTH_STATION_NAME_CHARS = 32
static

The maximum length of a station name in characters including '\0'.

Definition at line 90 of file station_type.h.

Referenced by CmdRenameStation(), CmdRenameWaypoint(), StationViewWindow::OnClick(), and WaypointWindow::OnClick().

◆ NEW_STATION

constexpr StationID NEW_STATION {0xFFFD}
staticconstexpr

Definition at line 18 of file station_type.h.

◆ STATION_FACILITY_GHOST

constexpr StationFacility STATION_FACILITY_GHOST {6}
staticconstexpr

Fake 'facility' to allow toggling display of recently-removed station signs.

Definition at line 64 of file station_type.h.

Referenced by MenuClickSettings(), and ToolbarOptionsClick().