diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-04 09:31:28 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-06 21:45:01 +0200 |
commit | 264991dfa506c0bdebb2e2c936f79a2412dad442 (patch) | |
tree | a84bfa41e32419866ced4478e30cd83a69a75b5f /src/settings.cpp | |
parent | 414e12d26be88043000aa7fe540edc974244dcc8 (diff) | |
download | openttd-264991dfa506c0bdebb2e2c936f79a2412dad442.tar.xz |
Codechange: move SLF_NO_NETWORK_SYNC into settings
It is a settings-only flag, so don't pollute SaveLoad code with it.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 93caff15d..c2594277d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -2025,9 +2025,15 @@ static void LoadSettings(const SettingTable &settings, void *object) for (auto &osd : settings) { if (osd->save.conv & SLF_NOT_IN_SAVE) continue; - void *ptr = GetVariableAddress(object, osd->save); + SaveLoad sl = osd->save; + if ((osd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server) { + /* We don't want to read this setting, so we do need to skip over it. */ + sl = SLE_NULL(static_cast<uint16>(SlCalcConvMemLen(osd->save.conv) * osd->save.length)); + } + + void *ptr = GetVariableAddress(object, sl); + if (!SlObjectMember(ptr, sl)) continue; - if (!SlObjectMember(ptr, osd->save)) continue; if (osd->IsIntSetting()) { const IntSettingDesc *int_setting = osd->AsIntSetting(); int_setting->MakeValueValidAndWrite(object, int_setting->Read(object)); |