(svn r13086) -Fix: do not crash badly after loading a newgrf with engines in-game that often
authorsmatz
Wed, 14 May 2008 15:29:48 +0000
changeset 9220 125a9aaf4b0a
parent 9219 d0ec4de51b30
child 9221 1cd04b558663
(svn r13086) -Fix: do not crash badly after loading a newgrf with engines in-game that often
src/engine.cpp
src/openttd.cpp
--- a/src/engine.cpp	Wed May 14 03:34:17 2008 +0000
+++ b/src/engine.cpp	Wed May 14 15:29:48 2008 +0000
@@ -141,6 +141,9 @@
 	qsort(&((*el)[begin]), num_items, sizeof(EngineID), compare);
 }
 
+
+/** Sets cached values in Player::num_vehicles and Group::num_vehicles
+ */
 void SetCachedEngineCounts()
 {
 	uint engines = GetEnginePoolSize();
--- a/src/openttd.cpp	Wed May 14 03:34:17 2008 +0000
+++ b/src/openttd.cpp	Wed May 14 15:29:48 2008 +0000
@@ -2538,6 +2538,7 @@
 	ResetVehiclePosHash();
 	AfterLoadVehicles(false);
 	StartupEngines();
+	SetCachedEngineCounts();
 	/* update station and waypoint graphics */
 	AfterLoadWaypoints();
 	AfterLoadStations();