Codechange: just pass the SettingDesc to SetSettingValue and remove distinction between (non)company
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user