diff options
author | Patric Stout <truebrain@openttd.org> | 2021-06-03 20:55:03 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-06-06 21:45:01 +0200 |
commit | 648ee88a02fef70172a108ed7bc511e27984d2c4 (patch) | |
tree | 20c4fd197f9815a812a6966c8467464bcd19da32 /src/settings.cpp | |
parent | 264991dfa506c0bdebb2e2c936f79a2412dad442 (diff) | |
download | openttd-648ee88a02fef70172a108ed7bc511e27984d2c4.tar.xz |
Codechange: merge guiflags and flags in settings .ini files
It was rather confusing which one was for what, especially as some
SaveLoad flags were settings-only. Clean up this mess a bit by
having only Setting flags.
Diffstat (limited to 'src/settings.cpp')
-rw-r--r-- | src/settings.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index c2594277d..c3afd5508 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -591,7 +591,7 @@ static void IniSaveSettings(IniFile *ini, const SettingTable &settings_table, co /* If the setting is not saved to the configuration * file, just continue with the next setting */ if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) continue; - if (sd->save.conv & SLF_NOT_IN_CONFIG) continue; + if (sd->flags & SF_NOT_IN_CONFIG) continue; /* XXX - wtf is this?? (group override?) */ std::string s{ sd->name }; @@ -741,7 +741,7 @@ void IniSaveWindowSettings(IniFile *ini, const char *grpname, void *desc) */ bool SettingDesc::IsEditable(bool do_command) const { - if (!do_command && !(this->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SF_PER_COMPANY)) return false; + if (!do_command && !(this->flags & SF_NO_NETWORK_SYNC) && _networking && !_network_server && !(this->flags & SF_PER_COMPANY)) return false; if ((this->flags & SF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return false; if ((this->flags & SF_NO_NETWORK) && _networking) return false; if ((this->flags & SF_NEWGAME_ONLY) && @@ -758,7 +758,7 @@ bool SettingDesc::IsEditable(bool do_command) const SettingType SettingDesc::GetType() const { if (this->flags & SF_PER_COMPANY) return ST_COMPANY; - return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME; + return (this->flags & SF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME; } /** @@ -1844,7 +1844,7 @@ bool SetSettingValue(const IntSettingDesc *sd, int32 value, bool force_newgame) * (if any) to change. Also *hack*hack* we update the _newgame version * of settings because changing a company-based setting in a game also * changes its defaults. At least that is the convention we have chosen */ - if (setting->save.conv & SLF_NO_NETWORK_SYNC) { + if (setting->flags & SF_NO_NETWORK_SYNC) { if (_game_mode != GM_MENU) { setting->ChangeValue(&_settings_newgame, value); } @@ -1899,7 +1899,7 @@ void SyncCompanySettings() */ bool SetSettingValue(const StringSettingDesc *sd, std::string value, bool force_newgame) { - assert(sd->save.conv & SLF_NO_NETWORK_SYNC); + assert(sd->flags & SF_NO_NETWORK_SYNC); if (GetVarMemType(sd->save.conv) == SLE_VAR_STRQ && value.compare("(null)") == 0) { value.clear(); @@ -2023,10 +2023,10 @@ void IConsoleListSettings(const char *prefilter) static void LoadSettings(const SettingTable &settings, void *object) { for (auto &osd : settings) { - if (osd->save.conv & SLF_NOT_IN_SAVE) continue; + if (osd->flags & SF_NOT_IN_SAVE) continue; SaveLoad sl = osd->save; - if ((osd->save.conv & SLF_NO_NETWORK_SYNC) && _networking && !_network_server) { + if ((osd->flags & SF_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)); } @@ -2053,14 +2053,14 @@ static void SaveSettings(const SettingTable &settings, void *object) * SlCalcLength() because we have a different format. So do this manually */ size_t length = 0; for (auto &sd : settings) { - if (sd->save.conv & SLF_NOT_IN_SAVE) continue; + if (sd->flags & SF_NOT_IN_SAVE) continue; length += SlCalcObjMemberLength(object, sd->save); } SlSetLength(length); for (auto &sd : settings) { - if (sd->save.conv & SLF_NOT_IN_SAVE) continue; + if (sd->flags & SF_NOT_IN_SAVE) continue; void *ptr = GetVariableAddress(object, sd->save); SlObjectMember(ptr, sd->save); |