changeset 18247:973050b62813 draft

(svn r23083) -Fix: run StartupEngines() if NewGRFs changed during loading a savegame, just like it's running when NewGRFs are changed during a game
author yexo <yexo@openttd.org>
date Thu, 03 Nov 2011 12:54:02 +0000
parents ab7b046b027c
children abe81a5bee85
files src/engine.cpp src/saveload/afterload.cpp
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -635,7 +635,10 @@
 	}
 }
 
-/** Start/initialise all our engines. */
+/**
+ * Start/initialise all our engines. Must be called whenever there are changes
+ * to the NewGRF config.
+ */
 void StartupEngines()
 {
 	Engine *e;
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2648,6 +2648,11 @@
 		}
 	}
 
+	/* When any NewGRF has been changed the availability of some vehicles might
+	 * have been changed too. e->company_avail must be set to 0 in that case
+	 * which is done by StartupEngines(). */
+	if (gcf_res != GLC_ALL_GOOD) StartupEngines();
+
 	/* Road stops is 'only' updating some caches */
 	AfterLoadRoadStops();
 	AfterLoadLabelMaps();