#9285 Add feature to remember scernario tab

This commit is contained in:
Spongeloaf 2019-06-21 12:54:49 -04:00
parent 6bd298b3a3
commit 5777074a3e
4 changed files with 17 additions and 3 deletions

View File

@ -960,6 +960,7 @@ static void window_options_mouseup(rct_window* w, rct_widgetindex widgetIndex)
{
SafeFree(gConfigGeneral.rct1_path);
gConfigGeneral.rct1_path = rct1path;
gConfigInterface.scenarioselect_last_tab = 0;
config_save_default();
context_show_error(STR_RESTART_REQUIRED, STR_NONE);
}
@ -1603,6 +1604,7 @@ static void window_options_dropdown(rct_window* w, rct_widgetindex widgetIndex,
if (dropdownIndex != gConfigGeneral.scenario_select_mode)
{
gConfigGeneral.scenario_select_mode = dropdownIndex;
gConfigInterface.scenarioselect_last_tab = 0;
config_save_default();
window_invalidate(w);
window_close_by_class(WC_SCENARIO_SELECT);

View File

@ -226,10 +226,17 @@ static void window_scenarioselect_init_tabs(rct_window* w)
}
}
int32_t firstPage = bitscanforward(showPages);
if (firstPage != -1)
if (showPages & 1 << gConfigInterface.scenarioselect_last_tab)
{
w->selected_tab = firstPage;
w->selected_tab = gConfigInterface.scenarioselect_last_tab;
}
else
{
int32_t firstPage = bitscanforward(showPages);
if (firstPage != -1)
{
w->selected_tab = firstPage;
}
}
int32_t x = 3;
@ -269,6 +276,8 @@ static void window_scenarioselect_mousedown(rct_window* w, rct_widgetindex widge
{
w->selected_tab = widgetIndex - 4;
w->highlighted_scenario = nullptr;
gConfigInterface.scenarioselect_last_tab = w->selected_tab;
config_save_default();
initialise_list_items(w);
window_invalidate(w);
window_event_resize_call(w);

View File

@ -300,6 +300,7 @@ namespace Config
model->current_theme_preset = reader->GetCString("current_theme", "*RCT2");
model->current_title_sequence_preset = reader->GetCString("current_title_sequence", "*OPENRCT2");
model->object_selection_filter_flags = reader->GetInt32("object_selection_filter_flags", 0x3FFF);
model->scenarioselect_last_tab = reader->GetInt32("scenarioselect_last_tab", 0);
}
}
@ -317,6 +318,7 @@ namespace Config
writer->WriteString("current_theme", model->current_theme_preset);
writer->WriteString("current_title_sequence", model->current_title_sequence_preset);
writer->WriteInt32("object_selection_filter_flags", model->object_selection_filter_flags);
writer->WriteInt32("scenarioselect_last_tab", model->scenarioselect_last_tab);
}
static void ReadSound(IIniReader* reader)

View File

@ -109,6 +109,7 @@ struct InterfaceConfiguration
utf8* current_theme_preset;
utf8* current_title_sequence_preset;
int32_t object_selection_filter_flags;
int32_t scenarioselect_last_tab;
};
struct SoundConfiguration