OpenTTD Source: src/station_type.h File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Enumerations | Variables
station_type.h File Reference

Types related to stations. More...

`#include "core/pool_type.hpp"`
`#include "tilearea_type.h"`

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 | StationFacilities = EnumBitSet< StationFacility, uint8_t >
using | StationRandomTriggers = EnumBitSet< StationRandomTrigger, uint8_t >
using | StationAnimationTriggers = EnumBitSet< StationAnimationTrigger, uint16_t >
using | AirportAnimationTriggers = EnumBitSet< AirportAnimationTrigger, uint8_t >
typedef std::set< Station *, StationCompare > | StationList
| 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...
enum class | StationRandomTrigger : uint8_t { NewCargo , CargoTaken , VehicleArrives , VehicleDeparts , VehicleLoads , PathReservation }
| Randomisation triggers for stations and roadstops. More...
enum class | StationAnimationTrigger : uint8_t { Built , NewCargo , CargoTaken , VehicleArrives , VehicleDeparts , VehicleLoads , AcceptanceTick , TileLoop , PathReservation , End }
| Animation triggers for stations and roadstops. More...
enum class | AirportAnimationTrigger : uint8_t { Built , TileLoop , NewCargo , CargoTaken , AcceptanceTick , AirplaneTouchdown }
| Animation triggers for airport tiles. 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

## ◆ AirportAnimationTriggers

using AirportAnimationTriggers = EnumBitSet<AirportAnimationTrigger, uint8_t>

Definition at line 111 of file station_type.h.

## ◆ RoadStopID

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

Definition at line 20 of file station_type.h.

## ◆ StationAnimationTriggers

using StationAnimationTriggers = EnumBitSet<StationAnimationTrigger, uint16_t>

Definition at line 100 of file station_type.h.

## ◆ StationFacilities

using StationFacilities = EnumBitSet<StationFacility, uint8_t>

Definition at line 58 of file station_type.h.

## ◆ StationID

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

Definition at line 16 of file station_type.h.

## ◆ StationList

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

List of stations.

Definition at line 131 of file station_type.h.

## ◆ StationRandomTriggers

using StationRandomTriggers = EnumBitSet<StationRandomTrigger, uint8_t>

Definition at line 85 of file station_type.h.

## Enumeration Type Documentation

## ◆ AirportAnimationTrigger

enum class AirportAnimationTrigger : uint8_t
| strong

Animation triggers for airport tiles.

Enumerator
Built | Triggered when the airport is built (for all tiles at the same time).
TileLoop | Triggered in the periodic tile loop.
NewCargo | Triggered when new cargo arrives at the station (for all tiles at the same time).
CargoTaken | Triggered when a cargo type is completely removed from the station (for all tiles at the same time).
AcceptanceTick | Triggered every 250 ticks (for all tiles at the same time).
AirplaneTouchdown | Triggered when an airplane (not a helicopter) touches down at the airport (for single tile).

Definition at line 103 of file station_type.h.

## ◆ 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 43 of file station_type.h.

## ◆ StationAnimationTrigger

enum class StationAnimationTrigger : uint8_t
| strong

Animation triggers for stations and roadstops.

Enumerator
Built | Trigger tile when built.
NewCargo | Trigger station on new cargo arrival.
CargoTaken | Trigger station when cargo is completely taken.
VehicleArrives | Trigger platform when train arrives.
VehicleDeparts | Trigger platform when train leaves.
VehicleLoads | Trigger platform when train loads/unloads.
AcceptanceTick | Trigger station every 250 ticks.
TileLoop | Trigger in the periodic tile loop.
PathReservation | Trigger platform when train reserves path.

Definition at line 88 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 50 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 64 of file station_type.h.

## ◆ StationRandomTrigger

enum class StationRandomTrigger : uint8_t
| strong

Randomisation triggers for stations and roadstops.

Enumerator
NewCargo | Trigger station on new cargo arrival.
CargoTaken | Trigger station when cargo is completely taken.
VehicleArrives | Trigger platform when train arrives.
VehicleDeparts | Trigger platform when train leaves.
VehicleLoads | Trigger platform when train loads/unloads.
PathReservation | Trigger platform when train reserves path.

Definition at line 77 of file station_type.h.

## ◆ StationType

enum class StationType : uint8_t
| strong

Station types.

Definition at line 29 of file station_type.h.

## Variable Documentation

## ◆ ADJACENT_STATION

constexpr StationID ADJACENT_STATION {0xFFFE}
| staticconstexpr

Definition at line 18 of file station_type.h.

## ◆ CA_BUS

constexpr uint CA_BUS = 3
| staticconstexpr

Catchment for bus stops with "modified catchment" enabled.

Definition at line 115 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 118 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 114 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 117 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 116 of file station_type.h.

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

## ◆ CA_UNMODIFIED

constexpr uint CA_UNMODIFIED = 4
| staticconstexpr

Catchment for all stations with "modified catchment" disabled.

Definition at line 120 of file station_type.h.

Referenced by ForAllStationsAroundTiles(), Station::GetCatchmentRadius(), GetTileCatchmentRadius(), BuildAirportWindow::OnPaint(), BuildDocksStationWindow::OnPaint(), BuildRailStationWindow::OnPaint(), and BuildRoadStationWindow::OnPaint().

## ◆ MAX_CATCHMENT

constexpr uint MAX_CATCHMENT = 10
| staticconstexpr

Maximum catchment for airports with "modified catchment" enabled.

Definition at line 122 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 124 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 17 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 61 of file station_type.h.

Referenced by MenuClickSettings(), and ToolbarOptionsClick().