# waypoint_base.h

Go to the documentation of this file.

    00001 /* $Id: waypoint_base.h 19141 2010-02-15 23:55:04Z 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 WAYPOINT_H
    00013 #define WAYPOINT_H
    00014
    00015 #include "base_station_base.h"
    00016
    00017 struct Waypoint : SpecializedStation<Waypoint, true> {
    00018   uint16 town_cn;
    00019
    00020   Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation<Waypoint, true>(tile) { }
    00021   ~Waypoint();
    00022
    00023   void UpdateVirtCoord();
    00024
    00025   /* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
    00026   {
    00027     return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
    00028   }
    00029
    00030   /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
    00031
    00032   /* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
    00033
    00034   /* virtual */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) const
    00035   {
    00036     return 1;
    00037   }
    00038
    00039   /* virtual */ uint GetPlatformLength(TileIndex tile) const
    00040   {
    00041     return 1;
    00042   }
    00043
    00048   FORCEINLINE bool IsSingleTile() const
    00049   {
    00050     return (this->facilities & FACIL_TRAIN) != 0 && this->train_station.w == 1 && this->train_station.h == 1;
    00051   }
    00052 };
    00053
    00054 #define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
    00055
    00056 #endif /* WAYPOINT_H */