(svn r23224) -Codechange: first load the config file partially so we can push scanning AIs to later in the process (when the GUI is showing the progress bar)
This commit is contained in:
@@ -1489,13 +1489,15 @@ static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *li
|
||||
}
|
||||
|
||||
/* Common handler for saving/loading variables to the configuration file */
|
||||
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list)
|
||||
static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescProcList *proc_list, bool minimal = false)
|
||||
{
|
||||
proc(ini, (const SettingDesc*)_misc_settings, "misc", NULL);
|
||||
#if defined(WIN32) && !defined(DEDICATED)
|
||||
proc(ini, (const SettingDesc*)_win32_settings, "win32", NULL);
|
||||
#endif /* WIN32 */
|
||||
|
||||
if (minimal) return;
|
||||
|
||||
proc(ini, _settings, "patches", &_settings_newgame);
|
||||
proc(ini, _currency_settings,"currency", &_custom_currency);
|
||||
proc(ini, _company_settings, "company", &_settings_client.company);
|
||||
@@ -1514,23 +1516,30 @@ static IniFile *IniLoadConfig()
|
||||
return ini;
|
||||
}
|
||||
|
||||
/** Load the values from the configuration files */
|
||||
void LoadFromConfig()
|
||||
/**
|
||||
* Load the values from the configuration files
|
||||
* @param minimal Load the minimal amount of the configuration to "bootstrap" the blitter and such.
|
||||
*/
|
||||
void LoadFromConfig(bool minimal)
|
||||
{
|
||||
IniFile *ini = IniLoadConfig();
|
||||
ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
|
||||
if (!minimal) ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
|
||||
|
||||
HandleSettingDescs(ini, IniLoadSettings, IniLoadSettingList);
|
||||
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
|
||||
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true);
|
||||
NewsDisplayLoadConfig(ini, "news_display");
|
||||
AILoadConfig(ini, "ai_players");
|
||||
HandleSettingDescs(ini, IniLoadSettings, IniLoadSettingList, minimal);
|
||||
|
||||
PrepareOldDiffCustom();
|
||||
IniLoadSettings(ini, _gameopt_settings, "gameopt", &_settings_newgame);
|
||||
HandleOldDiffCustom(false);
|
||||
if (!minimal) {
|
||||
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
|
||||
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true);
|
||||
NewsDisplayLoadConfig(ini, "news_display");
|
||||
AILoadConfig(ini, "ai_players");
|
||||
|
||||
PrepareOldDiffCustom();
|
||||
IniLoadSettings(ini, _gameopt_settings, "gameopt", &_settings_newgame);
|
||||
HandleOldDiffCustom(false);
|
||||
|
||||
ValidateSettings();
|
||||
}
|
||||
|
||||
ValidateSettings();
|
||||
delete ini;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user