diff options
Diffstat (limited to 'src/script/api')
-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) |