From ac0c1eb64b38b321144c7a983ee54cfc45249b8a Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 23 Mar 2012 23:04:32 +0000 Subject: [PATCH] - 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) --- src/p_glnodes.cpp | 1 - src/p_setup.cpp | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 7203b775ad..95c078eb84 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -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'); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 5e3c4b0ce2..6c5e2d9be1 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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; } }