Update readme.md
[openttd-joker.git] / src / station_type.h
blobecab44f7dd46aa50b9e86dca3f151cfec22431eb
1 /* $Id: station_type.h 25890 2013-10-20 13:47:11Z fonsinchen $ */
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;
22 typedef uint16 DockID;
24 struct BaseStation;
25 struct Station;
26 struct RoadStop;
27 struct Dock;
28 struct StationSpec;
29 struct Waypoint;
31 static const StationID NEW_STATION = 0xFFFE;
32 static const StationID INVALID_STATION = 0xFFFF;
34 static const uint MAX_STATION_CARGO_HISTORY_DAYS = 24;
35 static const uint STATION_CARGO_HISTORY_FACTOR = 25;
37 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
39 /** Station types */
40 enum StationType {
41 STATION_RAIL,
42 STATION_AIRPORT,
43 STATION_TRUCK,
44 STATION_BUS,
45 STATION_OILRIG,
46 STATION_DOCK,
47 STATION_BUOY,
48 STATION_WAYPOINT,
51 /** Types of RoadStops */
52 enum RoadStopType {
53 ROADSTOP_BUS, ///< A standard stop for buses
54 ROADSTOP_TRUCK, ///< A standard stop for trucks
57 /** The facilities a station might be having */
58 enum StationFacility {
59 FACIL_NONE = 0, ///< The station has no facilities at all
60 FACIL_TRAIN = 1 << 0, ///< Station with train station
61 FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops
62 FACIL_BUS_STOP = 1 << 2, ///< Station with bus stops
63 FACIL_AIRPORT = 1 << 3, ///< Station with an airport
64 FACIL_DOCK = 1 << 4, ///< Station with a dock
65 FACIL_WAYPOINT = 1 << 7, ///< Station is a waypoint
67 DECLARE_ENUM_AS_BIT_SET(StationFacility)
68 typedef SimpleTinyEnumT<StationFacility, byte> StationFacilityByte;
70 /** The vehicles that may have visited a station */
71 enum StationHadVehicleOfType {
72 HVOT_NONE = 0, ///< Station has seen no vehicles
73 HVOT_TRAIN = 1 << 1, ///< Station has seen a train
74 HVOT_BUS = 1 << 2, ///< Station has seen a bus
75 HVOT_TRUCK = 1 << 3, ///< Station has seen a truck
76 HVOT_AIRCRAFT = 1 << 4, ///< Station has seen an aircraft
77 HVOT_SHIP = 1 << 5, ///< Station has seen a ship
79 HVOT_WAYPOINT = 1 << 6, ///< Station is a waypoint (NewGRF only!)
81 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
82 typedef SimpleTinyEnumT<StationHadVehicleOfType, byte> StationHadVehicleOfTypeByte;
84 /** The different catchment areas used */
85 enum CatchmentArea {
86 CA_NONE = 0, ///< Catchment when the station has no facilities
87 CA_BUS = 3, ///< Catchment for bus stops with "modified catchment" enabled
88 CA_TRUCK = 3, ///< Catchment for truck stops with "modified catchment" enabled
89 CA_TRAIN = 4, ///< Catchment for train stations with "modified catchment" enabled
90 CA_DOCK = 5, ///< Catchment for docks with "modified catchment" enabled
92 CA_UNMODIFIED = 4, ///< Catchment for all stations with "modified catchment" disabled
94 MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
97 static const uint MAX_LENGTH_STATION_NAME_CHARS = 128; ///< The maximum length of a station name in characters including '\0'
99 /** List of station IDs */
100 typedef std::list<StationID> StationIDList;
102 /** List of stations */
103 typedef SmallVector<Station *, 2> StationList;
106 * Structure contains cached list of stations nearby. The list
107 * is created upon first call to GetStations()
109 class StationFinder : TileArea {
110 StationList stations; ///< List of stations nearby
111 public:
113 * Constructs StationFinder
114 * @param area the area to search from
116 StationFinder(const TileArea &area) : TileArea(area) {}
117 const StationList *GetStations();
120 #endif /* STATION_TYPE_H */