waypoint_base.h

Go to the documentation of this file.
00001 /* $Id$ */
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 WAYPOINT_BASE_H
00013 #define WAYPOINT_BASE_H
00014 
00015 #include "base_station_base.h"
00016 
00018 struct Waypoint FINAL : SpecializedStation<Waypoint, true> {
00019   uint16 town_cn;    
00020 
00025   Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation<Waypoint, true>(tile) { }
00026   ~Waypoint();
00027 
00028   void UpdateVirtCoord();
00029 
00030   /* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const
00031   {
00032     return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
00033   }
00034 
00035   /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
00036 
00037   /* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
00038 
00039   /* virtual */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) const
00040   {
00041     return 1;
00042   }
00043 
00044   /* virtual */ uint GetPlatformLength(TileIndex tile) const
00045   {
00046     return 1;
00047   }
00048 
00053   inline bool IsSingleTile() const
00054   {
00055     return (this->facilities & FACIL_TRAIN) != 0 && this->train_station.w == 1 && this->train_station.h == 1;
00056   }
00057 
00064   inline bool IsOfType(const Waypoint *wp) const
00065   {
00066     return this->string_id == wp->string_id;
00067   }
00068 };
00069 
00074 #define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
00075 
00076 #endif /* WAYPOINT_BASE_H */