W_IsLumpWad: check if the file is a PK3, so it can bail out if it isn't

This commit is contained in:
Monster Iestyn 2018-01-10 19:13:29 +00:00
parent 0c89853425
commit ddf82949bf

View file

@ -1056,14 +1056,19 @@ size_t W_LumpLength(lumpnum_t lumpnum)
// Is the lump a WAD? (presumably in a PK3) // Is the lump a WAD? (presumably in a PK3)
// //
boolean W_IsLumpWad(lumpnum_t lumpnum) boolean W_IsLumpWad(lumpnum_t lumpnum)
{
if (wadfiles[WADFILENUM(lumpnum)]->type == RET_PK3)
{ {
const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2; const char *lumpfullName = (wadfiles[WADFILENUM(lumpnum)]->lumpinfo + LUMPNUM(lumpnum))->name2;
if (strlen(lumpfullName) < 4) if (strlen(lumpfullName) < 4)
return false; // can't possibly be a wad can it? return false; // can't possibly be a WAD can it?
return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4); return !strnicmp(lumpfullName + strlen(lumpfullName) - 4, ".wad", 4);
} }
return false; // WADs should never be inside non-PK3s as far as SRB2 is concerned
}
/* report a zlib or i/o error */ /* report a zlib or i/o error */
void zerr(int ret) void zerr(int ret)
{ {