diff options
author | Patric Stout <truebrain@openttd.org> | 2021-05-31 10:56:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 10:56:06 +0200 |
commit | 921ab68a480afc969d2d8c8150c23250f245ba52 (patch) | |
tree | c3558f3d49bd5a565c6a21259a8723c8c61acf8f /src | |
parent | 043a5442482c852dc9d2bcdf311d588d137206cd (diff) | |
download | openttd-921ab68a480afc969d2d8c8150c23250f245ba52.tar.xz |
Codechange: use AsIntSetting()->Read() wrapper if possible (#9324)
Diffstat (limited to 'src')
-rw-r--r-- | src/news_gui.cpp | 5 | ||||
-rw-r--r-- | src/script/api/script_gamesettings.cpp | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp index a8d7c4398..731eb95c2 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -254,9 +254,8 @@ static_assert(lengthof(_news_type_data) == NT_END); NewsDisplay NewsTypeData::GetDisplay() const { const SettingDesc *sd = GetSettingFromName(this->name); - assert(sd != nullptr); - void *ptr = GetVariableAddress(nullptr, &sd->save); - return (NewsDisplay)ReadValue(ptr, sd->save.conv); + assert(sd != nullptr && sd->IsIntSetting()); + return (NewsDisplay)sd->AsIntSetting()->Read(nullptr); } /** Window class displaying a news item. */ diff --git a/src/script/api/script_gamesettings.cpp b/src/script/api/script_gamesettings.cpp index 0ade2d7cc..b1699d94f 100644 --- a/src/script/api/script_gamesettings.cpp +++ b/src/script/api/script_gamesettings.cpp @@ -26,9 +26,7 @@ if (!IsValid(setting)) return -1; const SettingDesc *sd = GetSettingFromName(setting); - - void *ptr = GetVariableAddress(&_settings_game, &sd->save); - return (int32)ReadValue(ptr, sd->save.conv); + return sd->AsIntSetting()->Read(&_settings_game); } /* static */ bool ScriptGameSettings::SetValue(const char *setting, int value) |