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/>.
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 "tilearea_type.h"
18 typedef uint16 StationID
;
19 typedef uint16 RoadStopID
;
27 static const StationID NEW_STATION
= 0xFFFE;
28 static const StationID INVALID_STATION
= 0xFFFF;
42 /** Types of RoadStops */
44 ROADSTOP_BUS
, ///< A standard stop for buses
45 ROADSTOP_TRUCK
///< A standard stop for trucks
48 /** The facilities a station might be having */
49 enum StationFacility
{
50 FACIL_NONE
= 0, ///< The station has no facilities at all
51 FACIL_TRAIN
= 1 << 0, ///< Station with train station
52 FACIL_TRUCK_STOP
= 1 << 1, ///< Station with truck stops
53 FACIL_BUS_STOP
= 1 << 2, ///< Station with bus stops
54 FACIL_AIRPORT
= 1 << 3, ///< Station with an airport
55 FACIL_DOCK
= 1 << 4, ///< Station with a dock
56 FACIL_WAYPOINT
= 1 << 7, ///< Station is a waypoint
58 DECLARE_ENUM_AS_BIT_SET(StationFacility
)
59 typedef SimpleTinyEnumT
<StationFacility
, byte
> StationFacilityByte
;
61 /** The vehicles that may have visited a station */
62 enum StationHadVehicleOfType
{
63 HVOT_NONE
= 0, ///< Station has seen no vehicles
64 HVOT_TRAIN
= 1 << 1, ///< Station has seen a train
65 HVOT_BUS
= 1 << 2, ///< Station has seen a bus
66 HVOT_TRUCK
= 1 << 3, ///< Station has seen a truck
67 HVOT_AIRCRAFT
= 1 << 4, ///< Station has seen an aircraft
68 HVOT_SHIP
= 1 << 5, ///< Station has seen a ship
70 HVOT_WAYPOINT
= 1 << 6, ///< Station is a waypoint (NewGRF only!)
72 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType
)
73 typedef SimpleTinyEnumT
<StationHadVehicleOfType
, byte
> StationHadVehicleOfTypeByte
;
75 /** The different catchment areas used */
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 /** List of stations */
91 typedef SmallVector
<Station
*, 2> StationList
;
94 * Structure contains cached list of stations nearby. The list
95 * is created upon first call to GetStations()
97 class StationFinder
: TileArea
{
98 StationList stations
; ///< List of stations nearby
101 * Constructs StationFinder
102 * @param area the area to search from
104 StationFinder(const TileArea
&area
) : TileArea(area
) {}
105 const StationList
*GetStations();
108 #endif /* STATION_TYPE_H */