- don't call BaseFileSearch inside of d_iwad.cpp since it is supposed to be treated as a private function.

This commit is contained in:
Rachael Alexanderson 2017-09-09 06:36:20 -04:00
parent 9a7f727aa4
commit bcc5830467
3 changed files with 10 additions and 12 deletions

View file

@ -51,9 +51,6 @@
#include "doomerrors.h" #include "doomerrors.h"
#include "v_text.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 (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
@ -491,7 +488,7 @@ void FIWadManager::ValidateIWADs()
static bool havepicked = false; static bool havepicked = false;
int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad) int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad, const char *optional_wad)
{ {
const char *iwadparm = Args->CheckValue ("-iwad"); const char *iwadparm = Args->CheckValue ("-iwad");
FString custwad; FString custwad;
@ -691,9 +688,8 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
D_AddFile (wadfiles, zdoom_wad); D_AddFile (wadfiles, zdoom_wad);
// [SP] Load non-free assets if available. This must be done before the IWAD. // [SP] Load non-free assets if available. This must be done before the IWAD.
const char *optionalassets = BaseFileSearch(OPTIONALWAD, NULL, true); if (optional_wad)
if (optionalassets) D_AddFile(wadfiles, optional_wad);
D_AddFile(wadfiles, optionalassets);
if (picks[pick].mRequiredPath.IsNotEmpty()) if (picks[pick].mRequiredPath.IsNotEmpty())
{ {
@ -730,9 +726,9 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
// //
//========================================================================== //==========================================================================
const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad) const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &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; //gameiwad = iwadType;
const FIWADInfo *iwad_info = &mIWadInfos[iwadType]; const FIWADInfo *iwad_info = &mIWadInfos[iwadType];
if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name; if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name;

View file

@ -2352,6 +2352,8 @@ void D_DoomMain (void)
} }
FString basewad = wad; FString basewad = wad;
FString optionalwad = BaseFileSearch(OPTIONALWAD, NULL, true);
iwad_man = new FIWadManager(basewad); iwad_man = new FIWadManager(basewad);
// Now that we have the IWADINFO, initialize the autoload ini sections. // Now that we have the IWADINFO, initialize the autoload ini sections.
@ -2384,7 +2386,7 @@ void D_DoomMain (void)
{ {
iwad_man = new FIWadManager(basewad); 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.gametype = iwad_info->gametype;
gameinfo.flags = iwad_info->flags; gameinfo.flags = iwad_info->flags;
gameinfo.ConfigName = iwad_info->Configname; gameinfo.ConfigName = iwad_info->Configname;

View file

@ -142,13 +142,13 @@ class FIWadManager
void ParseIWadInfo(const char *fn, const char *data, int datasize, FIWADInfo *result = nullptr); void ParseIWadInfo(const char *fn, const char *data, int datasize, FIWADInfo *result = nullptr);
int ScanIWAD (const char *iwad); int ScanIWAD (const char *iwad);
int CheckIWADInfo(const char *iwad); int CheckIWADInfo(const char *iwad);
int IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad); int IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad, const char *optional_wad);
void CollectSearchPaths(); void CollectSearchPaths();
void AddIWADCandidates(const char *dir); void AddIWADCandidates(const char *dir);
void ValidateIWADs(); void ValidateIWADs();
public: public:
FIWadManager(const char *fn); FIWadManager(const char *fn);
const FIWADInfo *FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad); const FIWADInfo *FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad, const char *optionalwad);
const FString *GetAutoname(unsigned int num) const const FString *GetAutoname(unsigned int num) const
{ {
if (num < mIWadInfos.Size()) return &mIWadInfos[num].Autoname; if (num < mIWadInfos.Size()) return &mIWadInfos[num].Autoname;