- Maps inside zips can now satisfy the map checks for IWAD detection.

- Fixed: F7ZFile did not delete its Archive when destroyed.


SVN r1967 (trunk)
This commit is contained in:
Randy Heit 2009-11-10 02:29:18 +00:00
parent 39bd295da8
commit a0d6a47daf
4 changed files with 52 additions and 7 deletions

View file

@ -1,3 +1,7 @@
November 9, 2009
- Maps inside zips can now satisfy the map checks for IWAD detection.
- Fixed: F7ZFile did not delete its Archive when destroyed.
November 7, 2009
- Fixed: The x64 Release build was configured to use the 32-bit GME, and
neither release nor debug builds built the library.

View file

@ -176,7 +176,7 @@ static EIWADType ScanIWAD (const char *iwad)
{ 'S','P','I','D','A','1','D','1' },
};
#define NUM_CHECKLUMPS (sizeof(checklumps)/8)
#define NUM_CHECKLUMPS (countof(checklumps))
enum
{
Check_ad2lib,
@ -202,7 +202,7 @@ static EIWADType ScanIWAD (const char *iwad)
Check_Gameinfo,
Check_e2m1
};
int lumpsfound[NUM_CHECKLUMPS];
bool lumpsfound[NUM_CHECKLUMPS];
size_t i;
memset (lumpsfound, 0, sizeof(lumpsfound));
@ -213,10 +213,44 @@ static EIWADType ScanIWAD (const char *iwad)
for(DWORD ii = 0; ii < iwadfile->LumpCount(); ii++)
{
FResourceLump *lump = iwadfile->GetLump(ii);
size_t j;
for (DWORD j = 0; j < NUM_CHECKLUMPS; j++)
if (strnicmp (lump->Name, checklumps[j], 8) == 0)
lumpsfound[j]++;
for (j = 0; j < NUM_CHECKLUMPS; j++)
{
if (!lumpsfound[j])
{
if (strnicmp (lump->Name, checklumps[j], 8) == 0)
{
lumpsfound[j] = true;
break;
}
// Check for maps inside zips, too.
else if (lump->FullName != NULL)
{
if (checklumps[j][0] == 'E' && checklumps[j][2] == 'M' && checklumps[j][4] == '\0')
{
if (strnicmp(lump->FullName, "maps/", 5) == 0 &&
strnicmp(lump->FullName + 5, checklumps[j], 4) == 0 &&
stricmp(lump->FullName + 9, ".wad") == 0)
{
lumpsfound[j] = true;
break;
}
}
else if (checklumps[j][0] == 'M' && checklumps[j][1] == 'A' && checklumps[j][2] == 'P' &&
checklumps[j][5] == '\0')
{
if (strnicmp(lump->FullName, "maps/", 5) == 0 &&
strnicmp(lump->FullName + 5, checklumps[j], 5) == 0 &&
stricmp(lump->FullName + 10, ".wad") == 0)
{
lumpsfound[j] = true;
break;
}
}
}
}
}
}
delete iwadfile;
}

View file

@ -310,7 +310,14 @@ bool F7ZFile::Open(bool quiet)
F7ZFile::~F7ZFile()
{
if (Lumps != NULL) delete [] Lumps;
if (Lumps != NULL)
{
delete[] Lumps;
}
if (Archive != NULL)
{
delete Archive;
}
}
//==========================================================================

View file

@ -1290,7 +1290,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
_CrtSetDbgFlag (_CrtSetDbgFlag(0) | _CRTDBG_LEAK_CHECK_DF);
// Use this to break at a specific allocation number.
//_crtBreakAlloc = 5501;
//_crtBreakAlloc = 3660;
#endif
DoMain (hInstance);