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

Method SetSetting

src/script/script_config.cpp:90–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void ScriptConfig::SetSetting(std::string_view name, int value)
91{
92 /* You can only set Script specific settings if an Script is selected. */
93 if (this->info == nullptr) return;
94
95 const ScriptConfigItem *config_item = this->info->GetConfigItem(name);
96 if (config_item == nullptr) return;
97
98 value = Clamp(value, config_item->min_value, config_item->max_value);
99
100 this->settings[std::string{name}] = value;
101}
102
103void ScriptConfig::ResetSettings()
104{

Callers 6

StringToSettingsMethod · 0.95
OnClickMethod · 0.80
SetValueMethod · 0.80
OnClickMethod · 0.80
SetValueMethod · 0.80

Calls 2

ClampFunction · 0.85
GetConfigItemMethod · 0.80

Tested by

no test coverage detected