Codechange: Use SQInteger for generic numbers in script_gamesettings

This commit is contained in:
glx22 2023-02-11 18:47:20 +01:00 committed by Loïc Guilloux
parent 6b8b4c392f
commit e784915b27
2 changed files with 7 additions and 4 deletions

View File

@ -22,7 +22,7 @@
return sd != nullptr && sd->IsIntSetting();
}
/* static */ int32 ScriptGameSettings::GetValue(const char *setting)
/* static */ SQInteger ScriptGameSettings::GetValue(const char *setting)
{
if (!IsValid(setting)) return -1;
@ -31,7 +31,7 @@
return sd->AsIntSetting()->Read(&_settings_game);
}
/* static */ bool ScriptGameSettings::SetValue(const char *setting, int value)
/* static */ bool ScriptGameSettings::SetValue(const char *setting, SQInteger value)
{
if (!IsValid(setting)) return false;
@ -40,6 +40,8 @@
if ((sd->flags & SF_NO_NETWORK_SYNC) != 0) return false;
value = Clamp<SQInteger>(value, INT32_MIN, INT32_MAX);
return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(sd->GetName(), value);
}

View File

@ -57,18 +57,19 @@ public:
* @note Results achieved in the past offer no guarantee for the future.
* @return The value for the setting.
*/
static int32 GetValue(const char *setting);
static SQInteger GetValue(const char *setting);
/**
* Sets the value of the game setting.
* @param setting The setting to set the value of.
* @param value The value to set the setting to.
* The value will be clamped to MIN(int32) .. MAX(int32).
* @pre IsValid(setting).
* @return True if the action succeeded.
* @note Results achieved in the past offer no guarantee for the future.
* @api -ai
*/
static bool SetValue(const char *setting, int value);
static bool SetValue(const char *setting, SQInteger value);
/**
* Checks whether the given vehicle-type is disabled for companies.