From 0d6597a9e6255193c306537aa0061b5a89b7c658 Mon Sep 17 00:00:00 2001 From: rubidium42 Date: Sat, 22 May 2021 21:09:30 +0200 Subject: Codechange: move bits of SettingDesc down to the appropriate sub classes And by doing so remove the hack where ints were put into pointers so "def" could either be an int or a string --- src/settings_gui.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/settings_gui.cpp') diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index ef1024278..18beb690a 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1035,8 +1035,7 @@ void SettingEntry::Init(byte level) /* Sets the given setting entry to its default value */ void SettingEntry::ResetAll() { - int32 default_value = ReadValue(&this->setting->def, this->setting->save.conv); - SetSettingValue(this->setting, default_value); + SetSettingValue(this->setting, this->setting->def); } /** @@ -1092,7 +1091,7 @@ bool SettingEntry::IsVisibleByRestrictionMode(RestrictionMode mode) const /* This entry shall only be visible, if the value deviates from its default value. */ /* Read the default value. */ - filter_value = ReadValue(&sd->def, sd->save.conv); + filter_value = sd->def; } else { assert(mode == RM_CHANGED_AGAINST_NEW); /* This entry shall only be visible, if the value deviates from @@ -2086,8 +2085,7 @@ struct GameSettingsWindow : Window { DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE); y += FONT_HEIGHT_NORMAL; - int32 default_value = ReadValue(&sd->def, sd->save.conv); - this->last_clicked->SetValueDParams(0, default_value); + this->last_clicked->SetValueDParams(0, sd->def); DrawString(r.left, r.right, y, STR_CONFIG_SETTING_DEFAULT_VALUE); y += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; @@ -2324,7 +2322,7 @@ struct GameSettingsWindow : Window { value = (int32)ClampToI32(llvalue); } else { - value = (int32)(size_t)sd->def; + value = sd->def; } SetSettingValue(this->valuewindow_entry->setting, value); -- cgit v1.2.3-70-g09d2