summaryrefslogtreecommitdiff
path: root/src/waypoint.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-22 08:59:57 +0000
committerrubidium <rubidium@openttd.org>2009-07-22 08:59:57 +0000
commit68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26 (patch)
treeee33bd19b96a138530a84e86e7ffd60c0700f9d9 /src/waypoint.h
parent2646a99d29535a44c5998f080131cbca2e85bdcf (diff)
downloadopenttd-68ead6b84f56ad3c93d05ad3e09b7fbb8173cf26.tar.xz
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
-Change: make (rail) waypoints sub classes of 'base stations', make buoys waypoints and unify code between them where possible.
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 */