mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 20:54:08 +01:00
Resolved by resetting settings to default values before the OPTS and PATS chunks are loaded.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include "../strings_type.h"
|
||||
#include "../newgrf_railtype.h"
|
||||
#include "../newgrf_roadtype.h"
|
||||
#include "../settings_internal.h"
|
||||
#include "saveload_internal.h"
|
||||
#include "saveload_filter.h"
|
||||
|
||||
@@ -2852,6 +2853,22 @@ void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settin
|
||||
extern bool AfterLoadGame();
|
||||
extern bool LoadOldSaveGame(const std::string &file);
|
||||
|
||||
/**
|
||||
* Reset all settings to their default, so any settings missing in the savegame
|
||||
* are their default, and not "value of last game". AfterLoad might still fix
|
||||
* up values to become non-default, depending on the saveload version.
|
||||
*/
|
||||
static void ResetSettings()
|
||||
{
|
||||
for (auto &desc : GetSaveLoadSettingTable()) {
|
||||
const SettingDesc *sd = GetSettingDesc(desc);
|
||||
if (sd->flags.Test(SettingFlag::NotInSave)) continue;
|
||||
if (sd->flags.Test(SettingFlag::NoNetworkSync) && _networking && !_network_server) continue;
|
||||
|
||||
sd->ResetToDefault(&_settings_game);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear temporary data that is passed between various saveload phases.
|
||||
*/
|
||||
@@ -2861,6 +2878,7 @@ static void ResetSaveloadData()
|
||||
ClearRailTypeLabelList();
|
||||
ClearRoadTypeLabelList();
|
||||
ResetOldWaypoints();
|
||||
ResetSettings();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user