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
 
@@ -251,15 +251,14 @@ static_assert(lengthof(_news_type_data) 
 
 * Return the news display option.
 
 * @return display options
 
 */
 
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. */
 
struct NewsWindow : Window {
 
	uint16 chat_height;   ///< Height of the chat window.
 
	uint16 status_height; ///< Height of the status bar window
src/script/api/script_gamesettings.cpp
Show inline comments
 
@@ -23,15 +23,13 @@
 

	
 
/* static */ int32 ScriptGameSettings::GetValue(const char *setting)
 
{
 
	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)
 
{
 
	if (!IsValid(setting)) return false;
 

	
0 comments (0 inline, 0 general)