From 511ddb028cf246aa7e8f8ba66c9d93d9c7aea00e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Apr 2009 18:12:40 +0000 Subject: [PATCH] - Fixed handling of embedded WADs. SVN r1559 (trunk) --- docs/rh-log.txt | 5 ++++- src/resourcefiles/resourcefile.cpp | 4 ++-- src/resourcefiles/resourcefile.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index fc63ac305..32861a6fb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ -April 23, 2009 (Changes by Graf Zahl) +April 25, 2009 (Changes by Graf Zahl) +- Fixed handling of embedded WADs. + +April 23, 2009 (Changes by Graf Zahl) - Added Gez's A_CheckCeiling submission. - Fixed: AM_NewResolution crashed when called from outside a level. - Added support for Quake PAK files. diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index 94fc8260b..5f36bc68e 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -78,7 +78,7 @@ FResourceLump::~FResourceLump() delete [] FullName; FullName = NULL; } - if (Cache != NULL) + if (Cache != NULL && RefCount >= 0) { delete [] Cache; Cache = NULL; @@ -150,7 +150,7 @@ void FResourceLump::LumpNameSetup(char *iname) void FResourceLump::CheckEmbedded() { // Checks for embedded archives - const char *c = strstr(Name, ".wad"); + const char *c = strstr(FullName, ".wad"); if (c && strlen(c) == 4 && !strchr(Name, '/')) { // Mark all embedded WADs diff --git a/src/resourcefiles/resourcefile.h b/src/resourcefiles/resourcefile.h index 8ac3264af..a74d53226 100644 --- a/src/resourcefiles/resourcefile.h +++ b/src/resourcefiles/resourcefile.h @@ -15,7 +15,7 @@ struct FResourceLump char * FullName; // only valid for files loaded from a .zip file char Name[9]; BYTE Flags; - BYTE RefCount; + SBYTE RefCount; char * Cache; FResourceFile * Owner; int Namespace;