- Fixed: If the znodes were based on a map with more vertexes than the one it is being loaded

for, reject them.

SVN r3477 (trunk)
This commit is contained in:
Randy Heit 2012-03-23 23:04:32 +00:00
parent f82024efbf
commit ac0c1eb64b
2 changed files with 7 additions and 6 deletions

View file

@ -851,7 +851,6 @@ static int FindGLNodesInFile(FileReader * f, const char * label)
bool P_LoadGLNodes(MapData * map)
{
if (map->MapLumps[ML_GLZNODES].Size != 0)
{
const int idcheck = MAKE_ID('Z','G','L','N');

View file

@ -974,6 +974,11 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
unsigned int i;
data >> orgVerts >> newVerts;
if (orgVerts > (DWORD)numvertexes)
{ // These nodes are based on a map with more vertex data than we have.
// We can't use them.
throw CRecoverableError("Incorrect number of vertexes in nodes.\n");
}
if (orgVerts + newVerts == (DWORD)numvertexes)
{
newvertarray = vertexes;
@ -1026,10 +1031,7 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
// segs used by subsectors.
if (numSegs != currSeg)
{
Printf ("Incorrect number of segs in nodes.\n");
delete[] subsectors;
ForceNodeBuild = true;
return;
throw CRecoverableError("Incorrect number of segs in nodes.\n");
}
numsegs = numSegs;
@ -3754,7 +3756,7 @@ void P_SetupLevel (char *lumpname, int position)
{
if (P_LoadGLNodes(map))
{
ForceNodeBuild=false;
ForceNodeBuild = false;
reloop = true;
}
}