From 9d877f75e3380a0ccf9ea45f7c1f8bcd5a781f9c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 8 Mar 2016 14:35:36 +0100 Subject: [PATCH] - second part of last commit. This file was accidentally unselected. --- src/d_iwad.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 68020dcec5..1fc63e03d3 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -381,13 +381,15 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads) // //========================================================================== +static bool havepicked = false; + int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, const char *zdoom_wad) { TArray wads; TArray foundwads; const char *iwadparm = Args->CheckValue ("-iwad"); - size_t numwads; int pickwad; + size_t numwads; size_t i; bool iwadparmfound = false; FString custwad; @@ -536,26 +538,29 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, { for (i = 0; i < numwads; ++i) { - FString basename = ExtractFileBase (wads[i].Path); - if (stricmp (basename, defaultiwad) == 0) + FString basename = ExtractFileBase(wads[i].Path); + if (stricmp(basename, defaultiwad) == 0) { defiwad = (int)i; break; } } } - pickwad = I_PickIWad (&wads[0], (int)numwads, queryiwad, defiwad); - if (pickwad >= 0) + if (!havepicked) // just use the first IWAD if the restart doesn't have a -iwad parameter. We cannot open the picker in fullscreen mode. { - // The newly selected IWAD becomes the new default - FString basename = ExtractFileBase (wads[pickwad].Path); - defaultiwad = basename; + pickwad = I_PickIWad(&wads[0], (int)numwads, queryiwad, defiwad); + if (pickwad >= 0) + { + // The newly selected IWAD becomes the new default + FString basename = ExtractFileBase(wads[pickwad].Path); + defaultiwad = basename; + } + if (pickwad < 0) + exit(0); + havepicked = true; } } - if (pickwad < 0) - exit (0); - // zdoom.pk3 must always be the first file loaded and the IWAD second. wadfiles.Clear(); D_AddFile (wadfiles, zdoom_wad);