Debug: Fix extra newline in vehicle flags when not expanded
[openttd-jgr.git] / src / station_type.h
blob20291eb10b7536fa6ee26dd5f7f0c54bff557fe8
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 */
8 /** @file station_type.h Types related to stations. */
10 #ifndef STATION_TYPE_H
11 #define STATION_TYPE_H
13 #include "core/smallstack_type.hpp"
14 #include "tilearea_type.h"
15 #include "3rdparty/cpp-btree/btree_set.h"
17 typedef uint16_t StationID;
18 typedef uint16_t RoadStopID;
19 typedef uint16_t DockID;
21 struct BaseStation;
22 struct Station;
23 struct RoadStop;
24 struct StationSpec;
25 struct Waypoint;
27 static const StationID NEW_STATION = 0xFFFE;
28 static const StationID INVALID_STATION = 0xFFFF;
30 static const uint MAX_STATION_CARGO_HISTORY_DAYS = 24;
32 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
34 /** Station types */
35 enum StationType : uint8_t {
36 STATION_RAIL,
37 STATION_AIRPORT,
38 STATION_TRUCK,
39 STATION_BUS,
40 STATION_OILRIG,
41 STATION_DOCK,
42 STATION_BUOY,
43 STATION_WAYPOINT,
44 STATION_ROADWAYPOINT,
45 STATION_END,
48 /** Types of RoadStops */
49 enum RoadStopType : uint8_t {
50 ROADSTOP_BUS, ///< A standard stop for buses
51 ROADSTOP_TRUCK, ///< A standard stop for trucks
54 /** The facilities a station might be having */
55 enum StationFacility : uint8_t {
56 FACIL_NONE = 0, ///< The station has no facilities at all
57 FACIL_TRAIN = 1 << 0, ///< Station with train station
58 FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops
59 FACIL_BUS_STOP = 1 << 2, ///< Station with bus stops
60 FACIL_AIRPORT = 1 << 3, ///< Station with an airport
61 FACIL_DOCK = 1 << 4, ///< Station with a dock
62 FACIL_WAYPOINT = 1 << 7, ///< Station is a waypoint
64 DECLARE_ENUM_AS_BIT_SET(StationFacility)
66 /** The vehicles that may have visited a station */
67 enum StationHadVehicleOfType : uint8_t {
68 HVOT_NONE = 0, ///< Station has seen no vehicles
69 HVOT_TRAIN = 1 << 1, ///< Station has seen a train
70 HVOT_BUS = 1 << 2, ///< Station has seen a bus
71 HVOT_TRUCK = 1 << 3, ///< Station has seen a truck
72 HVOT_AIRCRAFT = 1 << 4, ///< Station has seen an aircraft
73 HVOT_SHIP = 1 << 5, ///< Station has seen a ship
75 HVOT_WAYPOINT = 1 << 6, ///< Station is a waypoint (NewGRF only!)
77 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
79 /* The different catchment area sizes. */
80 static constexpr uint CA_NONE = 0; ///< Catchment when the station has no facilities
81 static constexpr uint CA_BUS = 3; ///< Catchment for bus stops with "modified catchment" enabled
82 static constexpr uint CA_TRUCK = 3; ///< Catchment for truck stops with "modified catchment" enabled
83 static constexpr uint CA_TRAIN = 4; ///< Catchment for train stations with "modified catchment" enabled
84 static constexpr uint CA_DOCK = 5; ///< Catchment for docks with "modified catchment" enabled
86 static constexpr uint CA_UNMODIFIED = 4; ///< Catchment for all stations with "modified catchment" disabled
88 static constexpr uint MAX_CATCHMENT = 10; ///< Maximum catchment for airports with "modified catchment" enabled
90 enum StationDelivery : uint8_t {
91 SD_NEAREST_FIRST = 0, ///< Station delivers cargo only to the nearest accepting industry
92 SD_BALANCED = 1 ///< Station delivers cargo equally among accepting industries
95 static const uint MAX_LENGTH_STATION_NAME_CHARS = 128; ///< The maximum length of a station name in characters including '\0'
97 struct StationCompare {
98 bool operator() (const Station *lhs, const Station *rhs) const;
101 /** List of stations */
102 typedef btree::btree_set<Station *, StationCompare> StationList;
105 * Structure contains cached list of stations nearby. The list
106 * is created upon first call to GetStations()
108 class StationFinder : TileArea {
109 StationList stations; ///< List of stations nearby
110 public:
112 * Constructs StationFinder
113 * @param area the area to search from
115 StationFinder(const TileArea &area) : TileArea(area) {}
116 const StationList &GetStations();
119 #endif /* STATION_TYPE_H */