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

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

View File

@@ -42,27 +42,6 @@ void WaypointsDailyLoop()
}
}
/**
* This hacks together some dummy one-shot Station structure for a waypoint.
* @param tile on which to work
* @return pointer to a Station
*/
Station *ComposeWaypointStation(TileIndex tile)
{
Waypoint *wp = Waypoint::GetByTile(tile);
/* instead of 'static Station stat' use byte array to avoid Station's destructor call upon exit. As
* a side effect, the station is not constructed now. */
static byte stat_raw[sizeof(Station)];
static Station &stat = *(Station*)stat_raw;
stat.train_tile = stat.xy = wp->xy;
stat.town = wp->town;
stat.build_date = wp->build_date;
return &stat;
}
/**
* Draw a waypoint
* @param x coordinate
@@ -82,8 +61,6 @@ void DrawWaypointSprite(int x, int y, int stat_id, RailType railtype)
Waypoint::~Waypoint()
{
free(this->name);
if (CleaningPool()) return;
DeleteWindowById(WC_WAYPOINT_VIEW, this->index);
RemoveOrderFromAllVehicles(OT_GOTO_WAYPOINT, this->index);