diff --git a/src/waypoint.h b/src/waypoint.h --- a/src/waypoint.h +++ b/src/waypoint.h @@ -14,10 +14,7 @@ #include "date_type.h" #include "core/pool_type.hpp" -typedef Pool WaypointPool; -extern WaypointPool _waypoint_pool; - -struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, SpecializedStation { +struct Waypoint : SpecializedStation { uint16 town_cn; ///< The Nth waypoint for this town (consecutive number) Waypoint(TileIndex tile = INVALID_TILE) : SpecializedStation(tile) { } @@ -27,29 +24,19 @@ struct Waypoint : WaypointPool::PoolItem /* 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 */