From bcc5830467e67ed9240ebb2a666d4af27dafb955 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 9 Sep 2017 06:36:20 -0400 Subject: [PATCH] - don't call BaseFileSearch inside of d_iwad.cpp since it is supposed to be treated as a private function. --- src/d_iwad.cpp | 14 +++++--------- src/d_main.cpp | 4 +++- src/d_main.h | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index a542866a1..202eb2b5e 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -51,9 +51,6 @@ #include "doomerrors.h" #include "v_text.h" -// external function declarations -const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false); - CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); @@ -491,7 +488,7 @@ void FIWadManager::ValidateIWADs() static bool havepicked = false; -int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, const char *zdoom_wad) +int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, const char *zdoom_wad, const char *optional_wad) { const char *iwadparm = Args->CheckValue ("-iwad"); FString custwad; @@ -691,9 +688,8 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, D_AddFile (wadfiles, zdoom_wad); // [SP] Load non-free assets if available. This must be done before the IWAD. - const char *optionalassets = BaseFileSearch(OPTIONALWAD, NULL, true); - if (optionalassets) - D_AddFile(wadfiles, optionalassets); + if (optional_wad) + D_AddFile(wadfiles, optional_wad); if (picks[pick].mRequiredPath.IsNotEmpty()) { @@ -730,9 +726,9 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, // //========================================================================== -const FIWADInfo *FIWadManager::FindIWAD(TArray &wadfiles, const char *iwad, const char *basewad) +const FIWADInfo *FIWadManager::FindIWAD(TArray &wadfiles, const char *iwad, const char *basewad, const char *optionalwad) { - int iwadType = IdentifyVersion(wadfiles, iwad, basewad); + int iwadType = IdentifyVersion(wadfiles, iwad, basewad, optionalwad); //gameiwad = iwadType; const FIWADInfo *iwad_info = &mIWadInfos[iwadType]; if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name; diff --git a/src/d_main.cpp b/src/d_main.cpp index d82925436..6edb88fdc 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2352,6 +2352,8 @@ void D_DoomMain (void) } FString basewad = wad; + FString optionalwad = BaseFileSearch(OPTIONALWAD, NULL, true); + iwad_man = new FIWadManager(basewad); // Now that we have the IWADINFO, initialize the autoload ini sections. @@ -2384,7 +2386,7 @@ void D_DoomMain (void) { iwad_man = new FIWadManager(basewad); } - const FIWADInfo *iwad_info = iwad_man->FindIWAD(allwads, iwad, basewad); + const FIWADInfo *iwad_info = iwad_man->FindIWAD(allwads, iwad, basewad, optionalwad); gameinfo.gametype = iwad_info->gametype; gameinfo.flags = iwad_info->flags; gameinfo.ConfigName = iwad_info->Configname; diff --git a/src/d_main.h b/src/d_main.h index 0cbdd9102..e5abd0e01 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -142,13 +142,13 @@ class FIWadManager void ParseIWadInfo(const char *fn, const char *data, int datasize, FIWADInfo *result = nullptr); int ScanIWAD (const char *iwad); int CheckIWADInfo(const char *iwad); - int IdentifyVersion (TArray &wadfiles, const char *iwad, const char *zdoom_wad); + int IdentifyVersion (TArray &wadfiles, const char *iwad, const char *zdoom_wad, const char *optional_wad); void CollectSearchPaths(); void AddIWADCandidates(const char *dir); void ValidateIWADs(); public: FIWadManager(const char *fn); - const FIWADInfo *FindIWAD(TArray &wadfiles, const char *iwad, const char *basewad); + const FIWADInfo *FindIWAD(TArray &wadfiles, const char *iwad, const char *basewad, const char *optionalwad); const FString *GetAutoname(unsigned int num) const { if (num < mIWadInfos.Size()) return &mIWadInfos[num].Autoname;