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/>.
10 /** @file waypoint_base.h Base of waypoints. */
12 #ifndef WAYPOINT_BASE_H
13 #define WAYPOINT_BASE_H
15 #include "base_station_base.h"
17 /** Representation of a waypoint. */
18 struct Waypoint FINAL
: SpecializedStation
<Waypoint
, true> {
19 uint16 town_cn
; ///< The N-1th waypoint for this town (consecutive number)
22 * Create a waypoint at the given tile.
23 * @param tile The location of the waypoint.
25 Waypoint(TileIndex tile
= INVALID_TILE
) : SpecializedStation
<Waypoint
, true>(tile
) { }
28 void UpdateVirtCoord();
30 inline bool TileBelongsToRailStation(TileIndex tile
) const
32 return IsRailWaypointTile(tile
) && GetStationIndex(tile
) == this->index
;
35 uint32
GetNewGRFVariable (const struct GRFFile
*grffile
, byte variable
, byte parameter
, bool *available
) const OVERRIDE
;
38 * Is this a single tile waypoint?
39 * @return true if it is.
41 inline bool IsSingleTile() const
43 return (this->facilities
& FACIL_TRAIN
) != 0 && this->train_station
.w
== 1 && this->train_station
.h
== 1;
47 * Is the "type" of waypoint the same as the given waypoint,
48 * i.e. are both a rail waypoint or are both a buoy?
49 * @param wp The waypoint to compare to.
50 * @return true iff their types are equal.
52 inline bool IsOfType(const Waypoint
*wp
) const
54 return this->string_id
== wp
->string_id
;
59 * Iterate over all waypoints.
60 * @param var The variable used for iteration.
62 #define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
64 #endif /* WAYPOINT_BASE_H */