summaryrefslogtreecommitdiff
path: root/src/waypoint.cpp
diff options
context:
space:
mode:
authorKUDr <kudr@openttd.org>2007-01-19 16:01:43 +0000
committerKUDr <kudr@openttd.org>2007-01-19 16:01:43 +0000
commit7b5ec98d99284a1ea122d9f7ca43c57309f42db7 (patch)
tree865b7cdf8fac0a061d05a046d2bd23ae70c66b29 /src/waypoint.cpp
parentb2def962481476a5fae92f8539e5f061022bf442 (diff)
downloadopenttd-7b5ec98d99284a1ea122d9f7ca43c57309f42db7.tar.xz
(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.
Diffstat (limited to 'src/waypoint.cpp')
-rw-r--r--src/waypoint.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index fe74d7ca7..4bd46efe0 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -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);