diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-18 20:57:44 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-27 18:49:43 +0200 |
commit | 8ffb4122df903393bceca49a25ac81cc42cca3ff (patch) | |
tree | 0e1d390cc284f83e8cde908f33e6d901e2533d0f /src/script | |
parent | db54e208256958f721bf74bf058b45039be5b488 (diff) | |
download | openttd-8ffb4122df903393bceca49a25ac81cc42cca3ff.tar.xz |
Codechange: just pass the SettingDesc to SetSettingValue and remove distinction between (non)company
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/script_gamesettings.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/script/api/script_gamesettings.cpp b/src/script/api/script_gamesettings.cpp index 2717d4ddd..12435d253 100644 --- a/src/script/api/script_gamesettings.cpp +++ b/src/script/api/script_gamesettings.cpp @@ -17,8 +17,7 @@ /* static */ bool ScriptGameSettings::IsValid(const char *setting) { - uint i; - const SettingDesc *sd = GetSettingFromName(setting, &i); + const SettingDesc *sd = GetSettingFromName(setting); return sd != nullptr && sd->desc.cmd != SDT_STDSTRING; } @@ -26,8 +25,7 @@ { if (!IsValid(setting)) return -1; - uint index; - const SettingDesc *sd = GetSettingFromName(setting, &index); + const SettingDesc *sd = GetSettingFromName(setting); void *ptr = GetVariableAddress(&_settings_game, &sd->save); if (sd->desc.cmd == SDT_BOOLX) return *(bool*)ptr; @@ -39,13 +37,12 @@ { if (!IsValid(setting)) return false; - uint index; - const SettingDesc *sd = GetSettingFromName(setting, &index); + const SettingDesc *sd = GetSettingFromName(setting); if ((sd->save.conv & SLF_NO_NETWORK_SYNC) != 0) return false; if (sd->desc.cmd != SDT_BOOLX && sd->desc.cmd != SDT_NUMX) return false; - return ScriptObject::DoCommand(0, index, value, CMD_CHANGE_SETTING); + return ScriptObject::DoCommand(0, GetSettingIndex(sd), value, CMD_CHANGE_SETTING); } /* static */ bool ScriptGameSettings::IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type) |