diff options
author | rubidium <rubidium@openttd.org> | 2009-07-17 21:06:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-17 21:06:06 +0000 |
commit | 4e5af51d1f56bc303dde2290a12cc219403b9c66 (patch) | |
tree | 216e244c8b6fcf4ca800797b064092436bcf98f0 /src/waypoint.h | |
parent | d8f16ea1994ecebdb153c58350b3a044a6d43e57 (diff) | |
download | openttd-4e5af51d1f56bc303dde2290a12cc219403b9c66.tar.xz |
(svn r16864) -Codechange: make Waypoints a subclass of BaseStation.
Diffstat (limited to 'src/waypoint.h')
-rw-r--r-- | src/waypoint.h | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/waypoint.h b/src/waypoint.h index f8f733ad8..1ffb74fe2 100644 --- a/src/waypoint.h +++ b/src/waypoint.h @@ -17,27 +17,21 @@ typedef Pool<Waypoint, WaypointID, 32, 64000> WaypointPool; extern WaypointPool _waypoint_pool; -struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> { - TileIndex xy; ///< Tile of waypoint - - Town *town; ///< Town associated with the waypoint +struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool>, BaseStation { uint16 town_cn; ///< The Nth waypoint for this town (consecutive number) - char *name; ///< Custom name. If not set, town + town_cn is used for naming - - ViewportSign sign; ///< Dimensions of sign (not saved) - Date build_date; ///< Date of construction - OwnerByte owner; ///< Whom this waypoint belongs to - - uint8 num_specs; ///< NOSAVE: Number of specs in the speclist - StationSpecList *speclist; ///< List of station specs of this station - - byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted. - Waypoint(TileIndex tile = INVALID_TILE) : xy(tile) { } + Waypoint(TileIndex tile = INVALID_TILE) : BaseStation(tile) { } ~Waypoint(); void UpdateVirtCoord(); + /* virtual */ FORCEINLINE bool TileBelongsToRailStation(TileIndex tile) const + { + return this->delete_ctr == 0 && this->xy == tile; + } + + /* virtual */ uint32 GetNewGRFVariable(const struct ResolverObject *object, byte variable, byte parameter, bool *available) const; + void AssignStationSpec(uint index); /** @@ -55,7 +49,6 @@ struct Waypoint : WaypointPool::PoolItem<&_waypoint_pool> { #define FOR_ALL_WAYPOINTS(var) FOR_ALL_WAYPOINTS_FROM(var, 0) CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove); -Station *ComposeWaypointStation(TileIndex tile); void ShowWaypointWindow(const Waypoint *wp); void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype); void UpdateAllWaypointVirtCoords(); |