MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SetValue

Method SetValue

src/script/api/script_gamesettings.cpp:34–47  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

32}
33
34/* static */ bool ScriptGameSettings::SetValue(const std::string &setting, SQInteger value)
35{
36 EnforceDeityOrCompanyModeValid(false);
37 if (!IsValid(setting)) return false;
38
39 const SettingDesc *sd = GetSettingFromName(setting);
40 assert(sd != nullptr);
41
42 if ((sd->flags.Test(SettingFlag::NoNetworkSync))) return false;
43
44 value = Clamp<SQInteger>(value, INT32_MIN, INT32_MAX);
45
46 return ScriptObject::Command<CMD_CHANGE_SETTING>::Do(sd->GetName(), value);
47}
48
49/* static */ bool ScriptGameSettings::IsDisabledVehicleType(ScriptVehicle::VehicleType vehicle_type)
50{

Callers

nothing calls this directly

Calls 3

GetSettingFromNameFunction · 0.85
TestMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected