(svn r8277) -Fix (r8038): assert on game exit when waypoints were used. The static variable of type Station (inside ComposeWaypointStation) replaced by byte array so no destructor is called for it on exit.

This commit is contained in:
KUDr 2007-01-19 16:01:43 +00:00
parent b2def96248
commit 7b5ec98d99
1 changed files with 5 additions and 1 deletions

View File

@ -353,7 +353,11 @@ int32 CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Station *ComposeWaypointStation(TileIndex tile)
{
Waypoint *wp = GetWaypointByTile(tile);
static Station stat;
/* 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 = GetTown(wp->town_index);