Mercurial > hg > openttd
changeset 5734:c9b0b0f0b69b draft
(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.
author | KUDr <KUDr@openttd.org> |
---|---|
date | Fri, 19 Jan 2007 16:01:43 +0000 |
parents | 0b9175cb534a |
children | 6dcf717d732f |
files | src/waypoint.cpp |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -353,7 +353,11 @@ 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);