From e98be8ed244e3d61ae0ae5c28bff8098bc2ff79f Mon Sep 17 00:00:00 2001 From: yexo Date: Thu, 3 Nov 2011 12:54:02 +0000 Subject: [PATCH] (svn r23083) -Fix: run StartupEngines() if NewGRFs changed during loading a savegame, just like it's running when NewGRFs are changed during a game --- src/engine.cpp | 5 ++++- src/saveload/afterload.cpp | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/engine.cpp b/src/engine.cpp index d59e2fb6f7..f0839aea7c 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -635,7 +635,10 @@ void StartupOneEngine(Engine *e, Date aging_date) } } -/** 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; diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 52f5e7bb5a..af6028d1c2 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2648,6 +2648,11 @@ bool AfterLoadGame() } } + /* 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();