OpenTTD Source 20251116-master-g21329071df
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 <http://www.gnu.org/licenses/>.
6 */
7
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
29enum class StationType : uint8_t {
30 Rail,
31 Airport,
32 Truck,
33 Bus,
34 Oilrig,
35 Dock,
36 Buoy,
37 RailWaypoint,
38 RoadWaypoint,
39 End,
40};
41
43enum class RoadStopType : uint8_t {
44 Bus,
45 Truck,
46 End,
47};
48
50enum class StationFacility : uint8_t {
51 Train = 0,
52 TruckStop = 1,
53 BusStop = 2,
54 Airport = 3,
55 Dock = 4,
56 Waypoint = 7,
57};
59
62
66 HVOT_TRAIN = 1 << 1,
67 HVOT_BUS = 1 << 2,
68 HVOT_TRUCK = 1 << 3,
69 HVOT_AIRCRAFT = 1 << 4,
70 HVOT_SHIP = 1 << 5,
71
72 HVOT_WAYPOINT = 1 << 6,
73};
75
76
86
101
103enum class AirportAnimationTrigger : uint8_t {
104 Built,
105 TileLoop,
106 NewCargo,
107 CargoTaken,
110};
112
113/* The different catchment area sizes. */
114static constexpr uint CA_NONE = 0;
115static constexpr uint CA_BUS = 3;
116static constexpr uint CA_TRUCK = 3;
117static constexpr uint CA_TRAIN = 4;
118static constexpr uint CA_DOCK = 5;
119
120static constexpr uint CA_UNMODIFIED = 4;
121
122static constexpr uint MAX_CATCHMENT = 10;
123
124static const uint MAX_LENGTH_STATION_NAME_CHARS = 32;
125
127 bool operator() (const Station *lhs, const Station *rhs) const;
128};
129
131typedef std::set<Station *, StationCompare> StationList;
132
139public:
144 StationFinder(const TileArea &area) : TileArea(area) {}
145 const StationList &GetStations();
146};
147
148#endif /* STATION_TYPE_H */
Structure contains cached list of stations nearby.
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.
@ End
End marker.
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
Definition of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle,...
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.
StationHadVehicleOfType
The vehicles that may have visited a station.
@ HVOT_WAYPOINT
Station is a waypoint (NewGRF only!)
@ HVOT_TRUCK
Station has seen a truck.
@ HVOT_NONE
Station has seen no vehicles.
@ HVOT_AIRCRAFT
Station has seen an aircraft.
@ HVOT_BUS
Station has seen a bus.
@ HVOT_SHIP
Station has seen a ship.
@ HVOT_TRAIN
Station has seen a train.
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.
StationType
Station types.
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.
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'.
AirportAnimationTrigger
Animation triggers for airport tiles.
@ AirplaneTouchdown
Triggered when an airplane (not a helicopter) touches down at the airport (for single tile).
All airport-related information.
Base class for all station-ish types.
Represents the covered area of e.g.
A Stop for a Road Vehicle.
Station specification.
Station data structure.
'Train' is either a loco or a wagon.
Definition train.h:91
Representation of a waypoint.
Type for storing the 'area' of something uses on the map.