diff options
author | rubidium42 <rubidium@openttd.org> | 2021-05-22 21:09:30 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-05-27 18:49:43 +0200 |
commit | 0d6597a9e6255193c306537aa0061b5a89b7c658 (patch) | |
tree | 5cf5348b0d768b836b43f3981e35a889701fb869 /src/settings_gui.cpp | |
parent | f58611298e17e925f98e9e36d1297f47650d4067 (diff) | |
download | openttd-0d6597a9e6255193c306537aa0061b5a89b7c658.tar.xz |
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
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r-- | src/settings_gui.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
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); |