OpenTTD
waypoint_base.h
Go to the documentation of this file.
1 /* $Id: waypoint_base.h 26085 2013-11-24 14:41:19Z frosch $ */
2 
3 /*
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/>.
8  */
9 
12 #ifndef WAYPOINT_BASE_H
13 #define WAYPOINT_BASE_H
14 
15 #include "base_station_base.h"
16 
18 struct Waypoint FINAL : SpecializedStation<Waypoint, true> {
19  uint16 town_cn;
20 
26  ~Waypoint();
27 
28  void UpdateVirtCoord();
29 
30  /* virtual */ inline bool TileBelongsToRailStation(TileIndex tile) const
31  {
32  return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
33  }
34 
35  /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject &object, byte variable, byte parameter, bool *available) const;
36 
37  /* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
38 
39  /* virtual */ uint GetPlatformLength(TileIndex tile, DiagDirection dir) const
40  {
41  return 1;
42  }
43 
44  /* virtual */ uint GetPlatformLength(TileIndex tile) const
45  {
46  return 1;
47  }
48 
53  inline bool IsSingleTile() const
54  {
55  return (this->facilities & FACIL_TRAIN) != 0 && this->train_station.w == 1 && this->train_station.h == 1;
56  }
57 
64  inline bool IsOfType(const Waypoint *wp) const
65  {
66  return this->string_id == wp->string_id;
67  }
68 };
69 
74 #define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
75 
76 #endif /* WAYPOINT_BASE_H */