Feature: Wide rivers
[openttd-github.git] / src / station_type.h
blob7696c0f0876605a655a69de3c6b0a494da2b2124
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 <set>
17 typedef uint16 StationID;
18 typedef uint16 RoadStopID;
20 struct BaseStation;
21 struct Station;
22 struct RoadStop;
23 struct StationSpec;
24 struct Waypoint;
26 static const StationID NEW_STATION = 0xFFFE;
27 static const StationID INVALID_STATION = 0xFFFF;
29 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
31 /** Station types */
32 enum StationType {
33 STATION_RAIL,
34 STATION_AIRPORT,
35 STATION_TRUCK,
36 STATION_BUS,
37 STATION_OILRIG,
38 STATION_DOCK,
39 STATION_BUOY,
40 STATION_WAYPOINT,
43 /** Types of RoadStops */
44 enum RoadStopType : byte {
45 ROADSTOP_BUS, ///< A standard stop for buses
46 ROADSTOP_TRUCK, ///< A standard stop for trucks
47 ROADSTOP_END, ///< End of valid types
50 /** The facilities a station might be having */
51 enum StationFacility : byte {
52 FACIL_NONE = 0, ///< The station has no facilities at all
53 FACIL_TRAIN = 1 << 0, ///< Station with train station
54 FACIL_TRUCK_STOP = 1 << 1, ///< Station with truck stops
55 FACIL_BUS_STOP = 1 << 2, ///< Station with bus stops
56 FACIL_AIRPORT = 1 << 3, ///< Station with an airport
57 FACIL_DOCK = 1 << 4, ///< Station with a dock
58 FACIL_WAYPOINT = 1 << 7, ///< Station is a waypoint
60 DECLARE_ENUM_AS_BIT_SET(StationFacility)
62 /** The vehicles that may have visited a station */
63 enum StationHadVehicleOfType : byte {
64 HVOT_NONE = 0, ///< Station has seen no vehicles
65 HVOT_TRAIN = 1 << 1, ///< Station has seen a train
66 HVOT_BUS = 1 << 2, ///< Station has seen a bus
67 HVOT_TRUCK = 1 << 3, ///< Station has seen a truck
68 HVOT_AIRCRAFT = 1 << 4, ///< Station has seen an aircraft
69 HVOT_SHIP = 1 << 5, ///< Station has seen a ship
71 HVOT_WAYPOINT = 1 << 6, ///< Station is a waypoint (NewGRF only!)
73 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
75 /** The different catchment areas used */
76 enum CatchmentArea {
77 CA_NONE = 0, ///< Catchment when the station has no facilities
78 CA_BUS = 3, ///< Catchment for bus stops with "modified catchment" enabled
79 CA_TRUCK = 3, ///< Catchment for truck stops with "modified catchment" enabled
80 CA_TRAIN = 4, ///< Catchment for train stations with "modified catchment" enabled
81 CA_DOCK = 5, ///< Catchment for docks with "modified catchment" enabled
83 CA_UNMODIFIED = 4, ///< Catchment for all stations with "modified catchment" disabled
85 MAX_CATCHMENT = 10, ///< Maximum catchment for airports with "modified catchment" enabled
88 static const uint MAX_LENGTH_STATION_NAME_CHARS = 32; ///< The maximum length of a station name in characters including '\0'
90 struct StationCompare {
91 bool operator() (const Station *lhs, const Station *rhs) const;
94 /** List of stations */
95 typedef std::set<Station *, StationCompare> StationList;
97 /**
98 * Structure contains cached list of stations nearby. The list
99 * is created upon first call to GetStations()
101 class StationFinder : TileArea {
102 StationList stations; ///< List of stations nearby
103 public:
105 * Constructs StationFinder
106 * @param area the area to search from
108 StationFinder(const TileArea &area) : TileArea(area) {}
109 const StationList *GetStations();
112 #endif /* STATION_TYPE_H */