From a1b066a0eb0d2cf5d17ad68ca833fcdd21f80725 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 10 Apr 2014 00:48:04 -0400 Subject: setup: Save selected game when browsing menus. Once a game type (IWAD) has been selected, remember that selection rather than resetting to the first item in the list when the window is closed and reopened. This fixes #169 (thanks Alexandre Xavier). --- src/setup/multiplayer.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/setup/multiplayer.c') diff --git a/src/setup/multiplayer.c b/src/setup/multiplayer.c index 35552349..8b461066 100644 --- a/src/setup/multiplayer.c +++ b/src/setup/multiplayer.c @@ -66,7 +66,7 @@ static char *iwad_labels[8]; // Index of the currently selected IWAD -static int found_iwad_selected; +static int found_iwad_selected = -1; // Filename to pass to '-iwad'. @@ -599,9 +599,15 @@ static txt_widget_t *IWADSelector(void) result = (txt_widget_t *) dropdown; } - // Select first in the list. + // The first time the dialog is opened, found_iwad_selected=-1, + // so select the first IWAD in the list. Don't lose the setting + // if we close and reopen the dialog. + + if (found_iwad_selected < 0 || found_iwad_selected >= num_iwads) + { + found_iwad_selected = 0; + } - found_iwad_selected = 0; IWADSelected(NULL, NULL); return result; -- cgit v1.2.3