summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-11-08 11:20:32 +0000
committerfrosch <frosch@openttd.org>2012-11-08 11:20:32 +0000
commitdc930b6689f383e9b30bfe83b4639dbfade5fe27 (patch)
tree68ff4d8a67dd755d912a32567843c3943cdbc73d
parent69a62452beab943a4f95d0aead7207d3f9de0a44 (diff)
downloadopenttd-dc930b6689f383e9b30bfe83b4639dbfade5fe27.tar.xz
(svn r24672) -Add [FS#5356]: Remember the basic/advanced/expert filter selection.
-rw-r--r--src/settings_gui.cpp19
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.ini8
3 files changed, 21 insertions, 7 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 33ca7a109..62c834e64 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1977,7 +1977,7 @@ struct GameSettingsWindow : QueryStringBaseWindow {
Scrollbar *vscroll;
- GameSettingsWindow(const WindowDesc *desc) : QueryStringBaseWindow(50), cur_restriction_mode(RM_BASIC)
+ GameSettingsWindow(const WindowDesc *desc) : QueryStringBaseWindow(50), cur_restriction_mode((RestrictionMode)_settings_client.gui.settings_restriction_mode)
{
static bool first_time = true;
@@ -2337,13 +2337,18 @@ struct GameSettingsWindow : QueryStringBaseWindow {
{
if (widget == WID_GS_RESTRICT_DROPDOWN) {
this->cur_restriction_mode = (RestrictionMode)index;
- if (!this->manually_changed_folding &&
- (this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT ||
+ if (this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT ||
this->cur_restriction_mode == RM_CHANGED_AGAINST_DEFAULT_WO_LOCAL ||
- this->cur_restriction_mode == RM_CHANGED_AGAINST_NEW)) {
- /* Expand all when selecting 'changes'. Update the filter state first, in case it becomes less restrictive in some cases. */
- _settings_main_page.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
- _settings_main_page.UnFoldAll();
+ this->cur_restriction_mode == RM_CHANGED_AGAINST_NEW) {
+
+ if (!this->manually_changed_folding) {
+ /* Expand all when selecting 'changes'. Update the filter state first, in case it becomes less restrictive in some cases. */
+ _settings_main_page.UpdateFilterState(string_filter, false, this->cur_restriction_mode);
+ _settings_main_page.UnFoldAll();
+ }
+ } else {
+ /* Non-'changes' filter. Save as default. */
+ _settings_client.gui.settings_restriction_mode = this->cur_restriction_mode;
}
this->InvalidateData();
return;
diff --git a/src/settings_type.h b/src/settings_type.h
index c29f512bc..8a34104fd 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -131,6 +131,7 @@ struct GUISettings {
bool newgrf_developer_tools; ///< activate NewGRF developer tools and allow modifying NewGRFs in an existing game
bool ai_developer_tools; ///< activate AI developer tools
bool scenario_developer; ///< activate scenario developer: allow modifying NewGRFs in an existing game
+ uint8 settings_restriction_mode; ///< selected restriction mode in adv. settings GUI. @see RestrictionMode
bool newgrf_show_old_versions; ///< whether to show old versions in the NewGRF list
uint8 newgrf_default_palette; ///< default palette to use for NewGRFs without action 14 palette information
diff --git a/src/table/settings.ini b/src/table/settings.ini
index f82e7f8e1..12157d1a8 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -2815,6 +2815,14 @@ flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false
[SDTC_VAR]
+var = gui.settings_restriction_mode
+type = SLE_UINT8
+flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
+def = 0
+min = 0
+max = 2
+
+[SDTC_VAR]
var = gui.developer
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC