OpenTTD Source 20260621-master-g720d10536d
station_type.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
9
10#ifndef STATION_TYPE_H
11#define STATION_TYPE_H
12
13#include "core/pool_type.hpp"
14#include "tilearea_type.h"
15
17static constexpr StationID NEW_STATION{0xFFFD};
18static constexpr StationID ADJACENT_STATION{0xFFFE};
19
21
22struct BaseStation;
23struct Station;
24struct RoadStop;
25struct StationSpec;
26struct Waypoint;
27
41
43enum class RoadStopType : uint8_t {
47};
48
50enum class StationFacility : uint8_t {
51 Train = 0,
53 BusStop = 2,
54 Airport = 3,
55 Dock = 4,
57};
58
61
64
66enum class StationVehicleType : uint8_t {
67 Train = 1,
68 Bus = 2,
69 Truck = 3,
71 Ship = 5,
72
74};
75
78
88
91
105
108
118
121
122/* The different catchment area sizes. */
123static constexpr uint CA_NONE = 0;
124static constexpr uint CA_BUS = 3;
125static constexpr uint CA_TRUCK = 3;
126static constexpr uint CA_TRAIN = 4;
127static constexpr uint CA_DOCK = 5;
128
129static constexpr uint CA_UNMODIFIED = 4;
130
131static constexpr uint MAX_CATCHMENT = 10;
132
133static const uint MAX_LENGTH_STATION_NAME_CHARS = 32;
134
136 bool operator() (const Station *lhs, const Station *rhs) const;
137};
138
140typedef std::set<Station *, StationCompare> StationList;
141
148public:
153 StationFinder(const TileArea &area) : TileArea(area) {}
154 const StationList &GetStations();
155};
156
157#endif /* STATION_TYPE_H */
Enum-as-bit-set wrapper.
const StationList & GetStations()
Run a tile loop to find stations around a tile, on demand.
StationList stations
List of stations nearby.
StationFinder(const TileArea &area)
Constructs StationFinder.
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
EnumBitSet< StationAnimationTrigger, uint16_t > StationAnimationTriggers
Bitset of StationAnimationTrigger elements.
static constexpr uint CA_TRAIN
Catchment for train stations with "modified catchment" enabled.
RoadStopType
Types of RoadStops.
static constexpr StationFacility STATION_FACILITY_GHOST
Fake 'facility' to allow toggling display of recently-removed station signs.
EnumBitSet< AirportAnimationTrigger, uint8_t > AirportAnimationTriggers
Bitset of AirportAnimationTrigger elements.
StationFacility
The facilities a station might be having.
@ TruckStop
Station with truck stops.
@ BusStop
Station with bus stops.
static constexpr uint CA_NONE
Catchment when the station has no facilities.
EnumBitSet< StationRandomTrigger, uint8_t > StationRandomTriggers
Bitset of StationRandomTrigger elements.
StationType
Station types.
@ Dock
Ship port.
@ Rail
Railways/train station.
@ Bus
Road stop for busses.
@ Truck
Road stop for trucks.
@ End
End marker.
@ RailWaypoint
Waypoint for trains.
@ Buoy
Waypoint for ships.
@ RoadWaypoint
Waypoint for trucks and busses.
@ Oilrig
Heliport on an oil rig.
StationRandomTrigger
Randomisation triggers for stations and roadstops.
@ VehicleArrives
Trigger platform when train arrives.
@ NewCargo
Trigger station on new cargo arrival.
@ PathReservation
Trigger platform when train reserves path.
@ VehicleDeparts
Trigger platform when train leaves.
@ CargoTaken
Trigger station when cargo is completely taken.
@ VehicleLoads
Trigger platform when train loads/unloads.
static constexpr uint MAX_CATCHMENT
Maximum catchment for airports with "modified catchment" enabled.
static constexpr uint CA_DOCK
Catchment for docks with "modified catchment" enabled.
static constexpr uint CA_BUS
Catchment for bus stops with "modified catchment" enabled.
static constexpr uint CA_UNMODIFIED
Catchment for all stations with "modified catchment" disabled.
std::set< Station *, StationCompare > StationList
List of stations.
StationAnimationTrigger
Animation triggers for stations and roadstops.
@ Built
Trigger tile when built.
@ TileLoop
Trigger in the periodic tile loop.
@ AcceptanceTick
Trigger station every 250 ticks.
EnumBitSet< StationFacility, uint8_t > StationFacilities
Bitset of StationFacility elements.
static constexpr uint CA_TRUCK
Catchment for truck stops with "modified catchment" enabled.
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
EnumBitSet< StationVehicleType, uint8_t > StationVehicleTypes
Bitset of StationVehicleType elements.
AirportAnimationTrigger
Animation triggers for airport tiles.
@ AirplaneTouchdown
Triggered when an airplane (not a helicopter) touches down at the airport (for single tile).
StationVehicleType
The vehicles that may have visited a station.
Aircraft, helicopters, rotors and their shadows belong to this class.
Definition aircraft.h:75
All airport-related information.
Base class for all station-ish types.
Templated helper to make a PoolID a single POD value.
Definition pool_type.hpp:50
A Stop for a Road Vehicle.
All ships have this type.
Definition ship.h:32
Station specification.
Station data structure.
'Train' is either a loco or a wagon.
Definition train.h:97
Representation of a waypoint.
Type for storing the 'area' of something uses on the map.
OrthogonalTileArea TileArea
Shorthand for the much more common orthogonal tile area.