1
0
Fork 0

Codechange: use AsIntSetting()->Read() wrapper if possible (#9324)

pull/9323/head
Patric Stout 2021-05-31 10:56:06 +02:00 committed by GitHub
parent 043a544248
commit 921ab68a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -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. */

View File

@ -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)