1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-16 17:02:37 +01:00

Fix #13849: Settings in old saves could be overridden by defaults. (#13874)

Resolved by resetting settings to default values before the OPTS and PATS chunks are loaded.
This commit is contained in:
Peter Nelson
2025-03-23 15:55:55 +00:00
committed by GitHub
parent 21d2a94809
commit 8b4114d709
4 changed files with 52 additions and 45 deletions

View File

@@ -1660,6 +1660,35 @@ void GetSaveLoadFromSettingTable(SettingTable settings, std::vector<SaveLoad> &s
}
}
/**
* Create a single table with all settings that should be stored/loaded
* in the savegame.
*/
SettingTable GetSaveLoadSettingTable()
{
static const SettingTable saveload_settings_tables[] = {
_difficulty_settings,
_economy_settings,
_game_settings,
_linkgraph_settings,
_locale_settings,
_pathfinding_settings,
_script_settings,
_world_settings,
};
static std::vector<SettingVariant> settings_table;
if (settings_table.empty()) {
for (auto &saveload_settings_table : saveload_settings_tables) {
for (auto &saveload_setting : saveload_settings_table) {
settings_table.push_back(saveload_setting);
}
}
}
return settings_table;
}
/**
* Given a name of setting, return a company setting description of it.
* @param name Name of the company setting to return a setting description of.