From 2f38d73f55a8927ceca131e74874d1d544d11fac Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 1 Feb 2007 12:21:14 +0000 Subject: Search IWAD search directories when loading PWAD files. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 830 --- src/d_iwad.c | 31 +++++++++++++++++++++++++++---- src/d_iwad.h | 2 ++ src/d_main.c | 48 +++++++++++++++++++++++++++++++++++++----------- 3 files changed, 66 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/d_iwad.c b/src/d_iwad.c index f352f1c2..1b3c29f1 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -416,10 +416,10 @@ static void BuildIWADDirList(void) } // -// Searches IWAD search paths for an IWAD with a specific name. +// Searches WAD search paths for an WAD with a specific filename. // -char *D_FindIWADByName(char *name) +char *D_FindWADByName(char *name) { char *buf; int i; @@ -456,6 +456,29 @@ char *D_FindIWADByName(char *name) return NULL; } +// +// D_TryWADByName +// +// Searches for a WAD by its filename, or passes through the filename +// if not found. +// + +char *D_TryFindWADByName(char *filename) +{ + char *result; + + result = D_FindWADByName(filename); + + if (result != NULL) + { + return result; + } + else + { + return filename; + } +} + // // FindIWAD // Checks availability of IWAD files by name, @@ -490,7 +513,7 @@ char *D_FindIWAD(void) iwadfile = myargv[iwadparm + 1]; - result = D_FindIWADByName(iwadfile); + result = D_FindWADByName(iwadfile); if (result == NULL) { @@ -762,7 +785,7 @@ void D_FindInstalledIWADs(void) for (i=0; i