summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-04 09:31:28 +0200
committerPatric Stout <github@truebrain.nl>2021-06-06 21:45:01 +0200
commit264991dfa506c0bdebb2e2c936f79a2412dad442 (patch)
treea84bfa41e32419866ced4478e30cd83a69a75b5f /src/settings.cpp
parent414e12d26be88043000aa7fe540edc974244dcc8 (diff)
downloadopenttd-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.cpp10
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));