diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f868f4bf2..202792890 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ -September 1, 2009 +September 2, 2009 (Changes by Graf Zahl) +- fixed: The newly altered WAD code could not load embedded WADs anymore. + +September 1, 2009 - Added directory detection to the -file parameter. This obsoletes -dir, so that parameter is now gone. - Removed automatic ".wad" appending from FWadCollection::InitMultipleFiles() diff --git a/src/w_wad.cpp b/src/w_wad.cpp index 10352fd24..4d1d554d9 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -225,30 +225,33 @@ int FWadCollection::AddExternalFile(const char *filename) void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) { int startlump; - bool isdir; + bool isdir = false; - // Does this exist? If so, is it a directory? - struct stat info; - if (stat(filename, &info) != 0) + if (wadinfo == NULL) { - Printf(TEXTCOLOR_RED "Could not stat %s\n", filename); - PrintLastError(); - return; - } - isdir = (info.st_mode & S_IFDIR) != 0; - - if (wadinfo == NULL && !isdir) - { - try + // Does this exist? If so, is it a directory? + struct stat info; + if (stat(filename, &info) != 0) { - wadinfo = new FileReader(filename); - } - catch (CRecoverableError &err) - { // Didn't find file - Printf (TEXTCOLOR_RED "%s\n", err.GetMessage()); - PrintLastError (); + Printf(TEXTCOLOR_RED "Could not stat %s\n", filename); + PrintLastError(); return; } + isdir = (info.st_mode & S_IFDIR) != 0; + + if (!isdir) + { + try + { + wadinfo = new FileReader(filename); + } + catch (CRecoverableError &err) + { // Didn't find file + Printf (TEXTCOLOR_RED "%s\n", err.GetMessage()); + PrintLastError (); + return; + } + } } Printf (" adding %s", filename); @@ -294,7 +297,7 @@ void FWadCollection::AddFile (const char *filename, FileReader *wadinfo) FileReader *embedded = lump->NewReader(); strcpy(wadstr, lump->FullName); - AddFile(wadstr, embedded); + AddFile(path, embedded); } } return;