# station_type.h

Go to the documentation of this file.

    00001 /* $Id: station_type.h 18377 2009-12-02 16:20:44Z rubidium $ */
    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/enum_type.hpp"
    00016 #include "core/smallvec_type.hpp"
    00017 #include "tile_type.h"
    00018
    00019 typedef uint16 StationID;
    00020 typedef uint16 RoadStopID;
    00021
    00022 struct BaseStation;
    00023 struct Station;
    00024 struct RoadStop;
    00025 struct StationSpec;
    00026 struct Waypoint;
    00027
    00028 static const StationID NEW_STATION = 0xFFFE;
    00029 static const StationID INVALID_STATION = 0xFFFF;
    00030
    00032 enum StationType {
    00033   STATION_RAIL,
    00034   STATION_AIRPORT,
    00035   STATION_TRUCK,
    00036   STATION_BUS,
    00037   STATION_OILRIG,
    00038   STATION_DOCK,
    00039   STATION_BUOY,
    00040   STATION_WAYPOINT,
    00041 };
    00042
    00044 enum RoadStopType {
    00045   ROADSTOP_BUS,
    00046   ROADSTOP_TRUCK
    00047 };
    00048
    00050 enum StationFacility {
    00051   FACIL_NONE       = 0,
    00052   FACIL_TRAIN      = 1 << 0,
    00053   FACIL_TRUCK_STOP = 1 << 1,
    00054   FACIL_BUS_STOP   = 1 << 2,
    00055   FACIL_AIRPORT    = 1 << 3,
    00056   FACIL_DOCK       = 1 << 4,
    00057   FACIL_WAYPOINT   = 1 << 7,
    00058 };
    00059 DECLARE_ENUM_AS_BIT_SET(StationFacility);
    00060 typedef SimpleTinyEnumT<StationFacility, byte> StationFacilityByte;
    00061
    00063 enum StationHadVehicleOfType {
    00064   HVOT_NONE     = 0,
    00065   HVOT_TRAIN    = 1 << 1,
    00066   HVOT_BUS      = 1 << 2,
    00067   HVOT_TRUCK    = 1 << 3,
    00068   HVOT_AIRCRAFT = 1 << 4,
    00069   HVOT_SHIP     = 1 << 5,
    00070
    00071   HVOT_WAYPOINT = 1 << 6,
    00072 };
    00073 DECLARE_ENUM_AS_BIT_SET(StationHadVehicleOfType);
    00074 typedef SimpleTinyEnumT<StationHadVehicleOfType, byte> StationHadVehicleOfTypeByte;
    00075
    00077 enum CatchmentArea {
    00078   CA_NONE            =  0,
    00079   CA_BUS             =  3,
    00080   CA_TRUCK           =  3,
    00081   CA_TRAIN           =  4,
    00082   CA_DOCK            =  5,
    00083
    00084   CA_UNMODIFIED      =  4,
    00085
    00086   MAX_CATCHMENT      = 10,
    00087 };
    00088
    00089 enum {
    00090   MAX_LENGTH_STATION_NAME_BYTES  =  31,
    00091   MAX_LENGTH_STATION_NAME_PIXELS = 180,
    00092 };
    00093
    00095 struct TileArea {
    00097   TileArea() {}
    00098
    00105   TileArea(TileIndex tile, uint8 w, uint8 h) : tile(tile), w(w), h(h) {}
    00106
    00112   TileArea(TileIndex start, TileIndex end);
    00113
    00114   TileIndex tile;
    00115   uint8 w;
    00116   uint8 h;
    00117
    00122   void Add(TileIndex to_add);
    00123
    00127   void Clear()
    00128   {
    00129     this->tile = INVALID_TILE;
    00130     this->w    = 0;
    00131     this->h    = 0;
    00132   }
    00133 };
    00134
    00136 typedef SmallVector<Station *, 2> StationList;
    00137
    00142 class StationFinder {
    00143   StationList stations;
    00144   TileIndex tile;
    00145   int x_extent;
    00146   int y_extent;
    00147 public:
    00154   StationFinder(TileIndex t, int dx, int dy) : tile(t), x_extent(dx), y_extent(dy) {}
    00155   const StationList *GetStations();
    00156 };
    00157
    00158 #endif /* STATION_TYPE_H */