- fixed: The newly altered WAD code could not load embedded WADs anymore.

SVN r1785 (trunk)
This commit is contained in:
Christoph Oelckers 2009-09-02 20:29:52 +00:00
parent c24c31cc9f
commit 1d582a7550
2 changed files with 27 additions and 21 deletions

View file

@ -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()

View file

@ -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;