summaryrefslogtreecommitdiff
path: root/src/waypoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/waypoint.h')
-rw-r--r--src/waypoint.h21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/waypoint.h b/src/waypoint.h
index 3dfcdac1e..62715de85 100644
--- a/src/waypoint.h
+++ b/src/waypoint.h
@@ -14,10 +14,7 @@
#include "date_type.h"
#include "core/pool_type.hpp"
-typedef Pool<Waypoint, WaypointID, 32, 64000> WaypointPool;
-extern WaypointPool _waypoint_pool;
-
-struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, SpecializedStation<Waypoint, true> {
+struct Waypoint : SpecializedStation<Waypoint, true> {
uint16 town_cn; ///< The Nth waypoint for this town (consecutive number)
Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation<Waypoint, true>(tile) { }
@@ -27,29 +24,19 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, SpecializedStation<Wa
/* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const
{
- return this->delete_ctr == 0 && this->xy == tile;
+ return IsRailWaypointTile(tile) && GetStationIndex(tile) == this->index;
}
/* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const;
/* virtual */ void GetTileArea(TileArea *ta, StationType type) const;
-
- /**
- * Fetch a waypoint by tile
- * @param tile Tile of waypoint
- * @return Waypoint
- */
- static FORCEINLINE Waypoint *GetByTile(TileIndex tile)
- {
- return Waypoint::Get(GetWaypointIndex(tile));
- }
};
-#define FOR_ALL_WAYPOINTS_FROM(var, start) FOR_ALL_ITEMS_FROM(Waypoint, waypoint_index, var, start)
-#define FOR_ALL_WAYPOINTS(var) FOR_ALL_WAYPOINTS_FROM(var, 0)
+#define FOR_ALL_WAYPOINTS(var) FOR_ALL_BASE_STATIONS_OF_TYPE(Waypoint, var)
CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove);
void ShowWaypointWindow(const Waypoint *wp);
void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype);
+void MakeDefaultWaypointName(Waypoint *wp);
#endif /* WAYPOINT_H */