(svn r16864) -Codechange: make Waypoints a subclass of BaseStation.

This commit is contained in:
rubidium
2009-07-17 21:06:06 +00:00
parent d8f16ea199
commit 4e5af51d1f
5 changed files with 59 additions and 53 deletions

View File

@@ -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();