Codechange: move SLF_NO_NETWORK_SYNC into settings

It is a settings-only flag, so don't pollute SaveLoad code with it.
This commit is contained in:
Patric Stout
2021-06-04 09:31:28 +02:00
committed by Patric Stout
parent 414e12d26b
commit 264991dfa5
3 changed files with 10 additions and 19 deletions

View File

@@ -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));