summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2007-03-26 12:09:53 +0000
committerSimon Howard2007-03-26 12:09:53 +0000
commitc8f42b1cc99bc3c099ff94bdeff79fe4be08a81c (patch)
tree4bacead665ecac6d2802eec46887a6999d68ac2a
parenta82e9f6157b06a05f78a74127fa9071074f6d450 (diff)
downloadchocolate-doom-c8f42b1cc99bc3c099ff94bdeff79fe4be08a81c.tar.gz
chocolate-doom-c8f42b1cc99bc3c099ff94bdeff79fe4be08a81c.tar.bz2
chocolate-doom-c8f42b1cc99bc3c099ff94bdeff79fe4be08a81c.zip
Search WAD search dirs when loading dehacked patches.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 863
-rw-r--r--src/d_iwad.c19
-rw-r--r--src/deh_main.c7
2 files changed, 20 insertions, 6 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c
index ef68ced9..895b5afb 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -43,6 +43,8 @@
// "128 IWAD search directories should be enough for anybody".
#define MAX_IWAD_DIRS 128
+
+static boolean iwad_dirs_built = false;
static char *iwad_dirs[MAX_IWAD_DIRS];
static int num_iwad_dirs = 0;
@@ -388,6 +390,11 @@ static void BuildIWADDirList(void)
{
char *doomwaddir;
+ if (iwad_dirs_built)
+ {
+ return;
+ }
+
// Look in the current directory. Doom always does this.
AddIWADDir(".");
@@ -420,6 +427,10 @@ static void BuildIWADDirList(void)
AddIWADDir("/usr/local/share/games/doom");
#endif
+
+ // Don't run this function again.
+
+ iwad_dirs_built = true;
}
//
@@ -438,6 +449,8 @@ char *D_FindWADByName(char *name)
{
return name;
}
+
+ BuildIWADDirList();
// Search through all IWAD paths for a file with the given name.
@@ -500,10 +513,6 @@ char *D_FindIWAD(void)
int iwadparm;
int i;
- // Build a list of locations to look for an IWAD
-
- BuildIWADDirList();
-
// Check for the -iwad parameter
//!
@@ -535,6 +544,8 @@ char *D_FindIWAD(void)
result = NULL;
+ BuildIWADDirList();
+
for (i=0; result == NULL && i<num_iwad_dirs; ++i)
{
result = SearchDirectoryForIWAD(iwad_dirs[i]);
diff --git a/src/deh_main.c b/src/deh_main.c
index 887dd1e4..ab205248 100644
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -29,6 +29,7 @@
#include "doomdef.h"
#include "doomtype.h"
+#include "d_iwad.h"
#include "m_argv.h"
#include "deh_defs.h"
@@ -335,6 +336,7 @@ static void DEH_ParseFile(char *filename)
void DEH_Init(void)
{
+ char *filename;
int p;
InitialiseSections();
@@ -354,8 +356,9 @@ void DEH_Init(void)
while (p < myargc && myargv[p][0] != '-')
{
- printf(" loading %s\n", myargv[p]);
- DEH_ParseFile(myargv[p]);
+ filename = D_TryFindWADByName(myargv[p]);
+ printf(" loading %s\n", filename);
+ DEH_ParseFile(filename);
++p;
}
}