# station_type.h

Go to the documentation of this file.

    00001 /* $Id: station_type.h 25890 2013-10-20 13:47:11Z fonsinchen $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef STATION_TYPE_H
    00013 #define STATION_TYPE_H
    00014
    00015 #include "core/smallvec_type.hpp"
    00016 #include "core/smallstack_type.hpp"
    00017 #include "tilearea_type.h"
    00018 #include <list>
    00019
    00020 typedef uint16 StationID;
    00021 typedef uint16 RoadStopID;
    00022
    00023 struct BaseStation;
    00024 struct Station;
    00025 struct RoadStop;
    00026 struct StationSpec;
    00027 struct Waypoint;
    00028
    00029 static const StationID NEW_STATION = 0xFFFE;
    00030 static const StationID INVALID_STATION = 0xFFFF;
    00031
    00032 typedef SmallStack<StationID, StationID, INVALID_STATION, 8, 0xFFFD> StationIDStack;
    00033
    00035 enum StationType {
    00036   STATION_RAIL,
    00037   STATION_AIRPORT,
    00038   STATION_TRUCK,
    00039   STATION_BUS,
    00040   STATION_OILRIG,
    00041   STATION_DOCK,
    00042   STATION_BUOY,
    00043   STATION_WAYPOINT,
    00044 };
    00045
    00047 enum RoadStopType {
    00048   ROADSTOP_BUS,
    00049   ROADSTOP_TRUCK,
    00050 };
    00051
    00053 enum StationFacility {
    00054   FACIL_NONE       = 0,
    00055   FACIL_TRAIN      = 1 << 0,
    00056   FACIL_TRUCK_STOP = 1 << 1,
    00057   FACIL_BUS_STOP   = 1 << 2,
    00058   FACIL_AIRPORT    = 1 << 3,
    00059   FACIL_DOCK       = 1 << 4,
    00060   FACIL_WAYPOINT   = 1 << 7,
    00061 };
    00062 DECLARE_ENUM_AS_BIT_SET(StationFacility)
    00063 typedef SimpleTinyEnumT<StationFacility, byte> StationFacilityByte;
    00064
    00066 enum StationHadVehicleOfType {
    00067   HVOT_NONE     = 0,
    00068   HVOT_TRAIN    = 1 << 1,
    00069   HVOT_BUS      = 1 << 2,
    00070   HVOT_TRUCK    = 1 << 3,
    00071   HVOT_AIRCRAFT = 1 << 4,
    00072   HVOT_SHIP     = 1 << 5,
    00073
    00074   HVOT_WAYPOINT = 1 << 6,
    00075 };
    00076 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType)
    00077 typedef SimpleTinyEnumT<StationHadVehicleOfType, byte> StationHadVehicleOfTypeByte;
    00078
    00080 enum CatchmentArea {
    00081   CA_NONE            =  0,
    00082   CA_BUS             =  3,
    00083   CA_TRUCK           =  3,
    00084   CA_TRAIN           =  4,
    00085   CA_DOCK            =  5,
    00086
    00087   CA_UNMODIFIED      =  4,
    00088
    00089   MAX_CATCHMENT      = 10,
    00090 };
    00091
    00092 static const uint MAX_LENGTH_STATION_NAME_CHARS = 32;
    00093
    00095 typedef std::list<StationID> StationIDList;
    00096
    00098 typedef SmallVector<Station *, 2> StationList;
    00099
    00104 class StationFinder : TileArea {
    00105   StationList stations;
    00106 public:
    00111   StationFinder(const TileArea &area) : TileArea(area) {}
    00112   const StationList *GetStations();
    00113 };
    00114
    00115 #endif /* STATION_TYPE_H */