From dd107ee25c30267887f9151f7cd39e80484c0b8f Mon Sep 17 00:00:00 2001 From: IntelOrca Date: Fri, 24 Jul 2015 20:15:13 +0100 Subject: [PATCH] save object selection filter, closes #1599 --- src/config.c | 1 + src/config.h | 1 + src/windows/editor_object_selection.c | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 256ccefa75..3ca1fbba27 100644 --- a/src/config.c +++ b/src/config.c @@ -195,6 +195,7 @@ config_property_definition _interfaceDefinitions[] = { { offsetof(interface_configuration, console_small_font), "console_small_font", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, current_theme_preset), "current_theme", CONFIG_VALUE_TYPE_STRING, { .value_string = "*RCT2" }, NULL }, { offsetof(interface_configuration, current_title_sequence_preset), "current_title_sequence", CONFIG_VALUE_TYPE_STRING, { .value_string = "*OPENRCT2" },NULL }, + { offsetof(interface_configuration, object_selection_filter_flags), "object_selection_filter_flags",CONFIG_VALUE_TYPE_UINT32, 0x7EF, NULL }, }; config_property_definition _soundDefinitions[] = { diff --git a/src/config.h b/src/config.h index e274e937c7..32b2ca06df 100644 --- a/src/config.h +++ b/src/config.h @@ -171,6 +171,7 @@ typedef struct { uint8 console_small_font; utf8string current_theme_preset; utf8string current_title_sequence_preset; + uint32 object_selection_filter_flags; } interface_configuration; typedef struct { diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 92f2a1499f..b885a55439 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -400,7 +400,7 @@ void window_editor_object_selection_open() (1 << WIDX_LIST_SORT_TYPE) | (1 << WIDX_LIST_SORT_RIDE); - _filter_flags = FILTER_ALL; + _filter_flags = gConfigInterface.object_selection_filter_flags; memset(_filter_string, 0, sizeof(_filter_string)); for (int i = WIDX_TAB_1; i <= WIDX_TAB_11; i++) @@ -793,6 +793,9 @@ static void window_editor_object_selection_mouseup(rct_window *w, int widgetInde break; case WIDX_FILTER_RIDE_TAB_ALL: _filter_flags |= 0x7E0; + gConfigInterface.object_selection_filter_flags = _filter_flags; + config_save_default(); + filter_update_counts(); visible_list_refresh(w); @@ -810,6 +813,8 @@ static void window_editor_object_selection_mouseup(rct_window *w, int widgetInde case WIDX_FILTER_RIDE_TAB_STALL: _filter_flags &= ~0x7E0; _filter_flags |= (1 << (widgetIndex - WIDX_FILTER_RIDE_TAB_TRANSPORT + 5)); + gConfigInterface.object_selection_filter_flags = _filter_flags; + config_save_default(); filter_update_counts(); visible_list_refresh(w); @@ -914,6 +919,8 @@ static void window_editor_object_selection_dropdown(rct_window *w, int widgetInd switch (widgetIndex) { case WIDX_FILTER_DROPDOWN: _filter_flags ^= (1 << dropdownIndex); + gConfigInterface.object_selection_filter_flags = _filter_flags; + config_save_default(); filter_update_counts(); w->scrolls->v_top = 0;