Fix ICU iterators on leading/trailing whitespace
[openttd/fttd.git] / src / station_type.h
blob7fa80d3bef734938c034076e836202440bf72e3c
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file station_type.h Types related to stations. */
12 #ifndef STATION_TYPE_H
13 #define STATION_TYPE_H
15 #include "core/smallvec_type.hpp"
16 #include "core/smallstack_type.hpp"
17 #include "map/tilearea.h"
18 #include <list>
20 typedef uint16 StationID;
21 typedef uint16 RoadStopID;
22 typedef uint16 DockID;
24 struct BaseStation;
25 struct Station;
26 struct RoadStop;
27 struct StationSpec;
28 struct Waypoint;
30 static const StationID NEW_STATION = 0xFFFE;
31 static const StationID INVALID_STATION = 0xFFFF;
33 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
35 /** Station types */
36 enum StationType {
37 STATION_RAIL,
38 STATION_AIRPORT,
39 STATION_TRUCK,
40 STATION_BUS,
41 STATION_OILRIG,
42 STATION_DOCK,
43 STATION_BUOY,
44 STATION_WAYPOINT,
47 /** Types of RoadStops */
48 enum RoadStopType {
49 ROADSTOP_BUS, ///< A standard stop for buses
50 ROADSTOP_TRUCK, ///< A standard stop for trucks
53 /** The facilities a station might be having */
54 enum StationFacility {
55 FACIL_NONE = 0, ///< The station has no facilities at all
56 FACIL_TRAIN = 1 << 0, ///< Station with train station
57 FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops
58 FACIL_BUS_STOP = 1 << 2, ///< Station with bus stops
59 FACIL_AIRPORT = 1 << 3, ///< Station with an airport
60 FACIL_DOCK = 1 << 4, ///< Station with a dock
61 FACIL_WAYPOINT = 1 << 7, ///< Station is a waypoint
63 DECLARE_ENUM_AS_BIT_SET(StationFacility)
64 typedef SimpleTinyEnumT<StationFacility, byte> StationFacilityByte;
66 /** The vehicles that may have visited a station */
67 enum StationHadVehicleOfType {
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)
78 typedef SimpleTinyEnumT<StationHadVehicleOfType, byte> StationHadVehicleOfTypeByte;
80 /** The different catchment areas used */
81 enum CatchmentArea {
82 CA_NONE = 0, ///< Catchment when the station has no facilities
83 CA_BUS = 3, ///< Catchment for bus stops with "modified catchment" enabled
84 CA_TRUCK = 3, ///< Catchment for truck stops with "modified catchment" enabled
85 CA_TRAIN = 4, ///< Catchment for train stations with "modified catchment" enabled
86 CA_DOCK = 5, ///< Catchment for docks with "modified catchment" enabled
88 CA_UNMODIFIED = 4, ///< Catchment for all stations with "modified catchment" disabled
90 MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
93 static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0'
95 /** List of station IDs */
96 typedef std::list<StationID> StationIDList;
98 /** List of stations */
99 typedef SmallVector<Station *, 2> StationList;
102 * Structure contains cached list of stations nearby. The list
103 * is created upon first call to GetStations()
105 class StationFinder : TileArea {
106 StationList stations; ///< List of stations nearby
107 public:
109 * Constructs StationFinder
110 * @param area the area to search from
112 StationFinder(const TileArea &area) : TileArea(area) {}
113 const StationList *GetStations();
116 #endif /* STATION_TYPE_H */