Changeset - r25583:f21803d6284b
[Not reviewed]
master
0 2 0
Patric Stout - 3 years ago 2021-05-31 08:56:06
truebrain@openttd.org
Codechange: use AsIntSetting()->Read() wrapper if possible (#9324)
2 files changed with 3 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -254,9 +254,8 @@ static_assert(lengthof(_news_type_data) 
 
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. */
src/script/api/script_gamesettings.cpp
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)