mirror of https://github.com/OpenTTD/OpenTTD
Codechange: use AsIntSetting()->Read() wrapper if possible (#9324)
parent
043a544248
commit
921ab68a48
|
@ -254,9 +254,8 @@ static_assert(lengthof(_news_type_data) == NT_END);
|
||||||
NewsDisplay NewsTypeData::GetDisplay() const
|
NewsDisplay NewsTypeData::GetDisplay() const
|
||||||
{
|
{
|
||||||
const SettingDesc *sd = GetSettingFromName(this->name);
|
const SettingDesc *sd = GetSettingFromName(this->name);
|
||||||
assert(sd != nullptr);
|
assert(sd != nullptr && sd->IsIntSetting());
|
||||||
void *ptr = GetVariableAddress(nullptr, &sd->save);
|
return (NewsDisplay)sd->AsIntSetting()->Read(nullptr);
|
||||||
return (NewsDisplay)ReadValue(ptr, sd->save.conv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Window class displaying a news item. */
|
/** Window class displaying a news item. */
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
if (!IsValid(setting)) return -1;
|
if (!IsValid(setting)) return -1;
|
||||||
|
|
||||||
const SettingDesc *sd = GetSettingFromName(setting);
|
const SettingDesc *sd = GetSettingFromName(setting);
|
||||||
|
return sd->AsIntSetting()->Read(&_settings_game);
|
||||||
void *ptr = GetVariableAddress(&_settings_game, &sd->save);
|
|
||||||
return (int32)ReadValue(ptr, sd->save.conv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool ScriptGameSettings::SetValue(const char *setting, int value)
|
/* static */ bool ScriptGameSettings::SetValue(const char *setting, int value)
|
||||||
|
|
Loading…
Reference in New Issue