Merge branch 'master' into jgrpp

# Conflicts:
#	src/station_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2022-07-03 17:42:54 +01:00
7 changed files with 157 additions and 84 deletions

View File

@@ -1013,6 +1013,20 @@ void HandleExitGameRequest()
}
}
/**
* Triggers everything required to set up a saved scenario for a new game.
*/
static void OnStartScenario()
{
/* Reset engine pool to simplify changing engine NewGRFs in scenario editor. */
EngineOverrideManager::ResetToCurrentNewGRFConfig();
/* Make sure all industries were built "this year", to avoid too early closures. (#9918) */
for (Industry *i : Industry::Iterate()) {
i->last_prod_year = _cur_year;
}
}
/**
* Triggers everything that should be triggered when starting a game.
* @param dedicated_server Whether this is a dedicated server or not.
@@ -1258,8 +1272,7 @@ void SwitchToMode(SwitchMode new_mode)
ShowErrorMessage(STR_JUST_RAW_STRING, INVALID_STRING_ID, WL_ERROR);
} else {
if (_file_to_saveload.abstract_ftype == FT_SCENARIO) {
/* Reset engine pool to simplify changing engine NewGRFs in scenario editor. */
EngineOverrideManager::ResetToCurrentNewGRFConfig();
OnStartScenario();
}
OnStartGame(_network_dedicated);
/* Decrease pause counter (was increased from opening load dialog) */