diff options
author | Patric Stout <truebrain@openttd.org> | 2021-07-09 21:16:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-09 21:16:03 +0200 |
commit | 8f5d0ecde39cbaf2ac1a6d27e82239bfc3bf1515 (patch) | |
tree | 232daba5b6f77f8ae33191c0b88dd21ef662a1c1 /src/settings.cpp | |
parent | d9ca9ca55571829af88429147e20bf0734e07e2d (diff) | |
download | openttd-8f5d0ecde39cbaf2ac1a6d27e82239bfc3bf1515.tar.xz |
Codechange: split settings.ini over several files (#9421)
This reduced the load on compilers, as currently for example MacOS
doesn't like the huge settings-tables.
Additionally, nobody can find settings, as the list is massive and
unordered. By splitting it, it becomes a little bit more sensible.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index e3741c235..09223c585 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -72,8 +72,18 @@ static ErrorList _settings_error_list; ///< Errors while loading minimal setting static auto &GenericSettingTables() { static const SettingTable _generic_setting_tables[] = { - _settings, + _difficulty_settings, + _economy_settings, + _game_settings, + _gui_settings, + _linkgraph_settings, + _locale_settings, + _multimedia_settings, _network_settings, + _news_display_settings, + _pathfinding_settings, + _script_settings, + _world_settings, }; return _generic_setting_tables; } @@ -1207,7 +1217,7 @@ void LoadFromConfig(bool startup) GameLoadConfig(generic_ini, "game_scripts"); PrepareOldDiffCustom(); - IniLoadSettings(generic_ini, _gameopt_settings, "gameopt", &_settings_newgame, false); + IniLoadSettings(generic_ini, _old_gameopt_settings, "gameopt", &_settings_newgame, false); HandleOldDiffCustom(false); ValidateSettings(); @@ -1393,16 +1403,16 @@ static const SettingDesc *GetSettingFromName(const std::string_view name, const } /** - * Get the SaveLoad from all settings matching the prefix. - * @param prefix The prefix to look for. + * Get the SaveLoad for all settings in the settings table. + * @param settings The settings table to get the SaveLoad objects from. * @param saveloads A vector to store the result in. */ -void GetSettingSaveLoadByPrefix(std::string_view prefix, std::vector<SaveLoad> &saveloads) +void GetSaveLoadFromSettingTable(SettingTable settings, std::vector<SaveLoad> &saveloads) { - for (auto &desc : _settings) { + for (auto &desc : settings) { const SettingDesc *sd = GetSettingDesc(desc); if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; - if (StrStartsWith(sd->name, prefix)) saveloads.push_back(sd->save); + saveloads.push_back(sd->save); } } |