- Initialize the nerve checksum at compile-time instead of run-time.

- Fixed: Crash in FWadCollection::RenameNerve() for files without a FileReader object.

SVN r3932 (trunk)
This commit is contained in:
Randy Heit 2012-11-03 00:38:58 +00:00
parent aab12c6b0c
commit d0c3c924d4
1 changed files with 16 additions and 14 deletions

View File

@ -828,13 +828,17 @@ void FWadCollection::RenameNerve ()
bool found = false;
BYTE cksum[16];
BYTE nerve[16] = { 0x96, 0x7d, 0x5a, 0xe2, 0x3d, 0xaf, 0x45, 0x19,
static const BYTE nerve[16] = { 0x96, 0x7d, 0x5a, 0xe2, 0x3d, 0xaf, 0x45, 0x19,
0x62, 0x12, 0xae, 0x1b, 0x60, 0x5d, 0xa3, 0xb0 };
size_t nervesize = 3819855; // NERVE.WAD's file size
int w = IWAD_FILENUM;
while (++w < GetNumWads())
{
FileReader *fr = GetFileReader(w);
if (fr == NULL)
{
continue;
}
if (fr->GetLength() != nervesize)
{
// Skip MD5 computation when there is a
@ -855,11 +859,10 @@ void FWadCollection::RenameNerve ()
if (!found)
return;
for (DWORD i = 0; i < LumpInfo.Size(); i++)
for (int i = GetFirstLump(w); i <= GetLastLump(w); i++)
{
// Only rename the maps from NERVE.WAD
if (LumpInfo[i].wadnum == w)
{
assert(LumpInfo[i].wadnum == w);
if (LumpInfo[i].lump->dwName == MAKE_ID('C', 'W', 'I', 'L'))
{
LumpInfo[i].lump->Name[0] = 'N';
@ -873,7 +876,6 @@ void FWadCollection::RenameNerve ()
}
}
}
}
//==========================================================================
//