(svn r27756) -Codechange: Add StringTab enum
[openttd.git] / src / station_type.h
blob952a683d74f6851e0e31b60b66e0a8b7dbc15781
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 "tilearea_type.h"
18 #include <list>
20 typedef uint16 StationID;
21 typedef uint16 RoadStopID;
23 struct BaseStation;
24 struct Station;
25 struct RoadStop;
26 struct StationSpec;
27 struct Waypoint;
29 static const StationID NEW_STATION = 0xFFFE;
30 static const StationID INVALID_STATION = 0xFFFF;
32 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
34 /** Station types */
35 enum StationType {
36 STATION_RAIL,
37 STATION_AIRPORT,
38 STATION_TRUCK,
39 STATION_BUS,
40 STATION_OILRIG,
41 STATION_DOCK,
42 STATION_BUOY,
43 STATION_WAYPOINT,
46 /** Types of RoadStops */
47 enum RoadStopType {
48 ROADSTOP_BUS, ///< A standard stop for buses
49 ROADSTOP_TRUCK, ///< A standard stop for trucks
52 /** The facilities a station might be having */
53 enum StationFacility {
54 FACIL_NONE = 0, ///< The station has no facilities at all
55 FACIL_TRAIN = 1 << 0, ///< Station with train station
56 FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops
57 FACIL_BUS_STOP = 1 << 2, ///< Station with bus stops
58 FACIL_AIRPORT = 1 << 3, ///< Station with an airport
59 FACIL_DOCK = 1 << 4, ///< Station with a dock
60 FACIL_WAYPOINT = 1 << 7, ///< Station is a waypoint
62 DECLARE_ENUM_AS_BIT_SET(StationFacility)
63 typedef SimpleTinyEnumT<StationFacility, byte> StationFacilityByte;
65 /** The vehicles that may have visited a station */
66 enum StationHadVehicleOfType {
67 HVOT_NONE = 0, ///< Station has seen no vehicles
68 HVOT_TRAIN = 1 << 1, ///< Station has seen a train
69 HVOT_BUS = 1 << 2, ///< Station has seen a bus
70 HVOT_TRUCK = 1 << 3, ///< Station has seen a truck
71 HVOT_AIRCRAFT = 1 << 4, ///< Station has seen an aircraft
72 HVOT_SHIP = 1 << 5, ///< Station has seen a ship
74 HVOT_WAYPOINT = 1 << 6, ///< Station is a waypoint (NewGRF only!)
76 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
77 typedef SimpleTinyEnumT<StationHadVehicleOfType, byte> StationHadVehicleOfTypeByte;
79 /** The different catchment areas used */
80 enum CatchmentArea {
81 CA_NONE = 0, ///< Catchment when the station has no facilities
82 CA_BUS = 3, ///< Catchment for bus stops with "modified catchment" enabled
83 CA_TRUCK = 3, ///< Catchment for truck stops with "modified catchment" enabled
84 CA_TRAIN = 4, ///< Catchment for train stations with "modified catchment" enabled
85 CA_DOCK = 5, ///< Catchment for docks with "modified catchment" enabled
87 CA_UNMODIFIED = 4, ///< Catchment for all stations with "modified catchment" disabled
89 MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
92 static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0'
94 /** List of station IDs */
95 typedef std::list<StationID> StationIDList;
97 /** List of stations */
98 typedef SmallVector<Station *, 2> StationList;
101 * Structure contains cached list of stations nearby. The list
102 * is created upon first call to GetStations()
104 class StationFinder : TileArea {
105 StationList stations; ///< List of stations nearby
106 public:
108 * Constructs StationFinder
109 * @param area the area to search from
111 StationFinder(const TileArea &area) : TileArea(area) {}
112 const StationList *GetStations();
115 #endif /* STATION_TYPE_H */