diff --git a/src/p_setup.cpp b/src/p_setup.cpp index e843cc655..ad713fab9 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -122,8 +122,7 @@ inline bool P_LoadBuildMap(BYTE *mapdata, size_t len, FMapThing **things, int *n // MAP related Lookup tables. // Store VERTEXES, LINEDEFS, SIDEDEFS, etc. // -int numvertexdatas; -vertexdata_t* vertexdatas; +TArray vertexdatas; int numsegs; seg_t* segs; @@ -833,7 +832,6 @@ void P_LoadVertexes (MapData * map) // Determine number of vertices: // total lump length / vertex record length. unsigned numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t); - numvertexdatas = 0; if (numvertexes == 0) { @@ -842,7 +840,7 @@ void P_LoadVertexes (MapData * map) // Allocate memory for buffer. level.vertexes.Alloc(numvertexes); - vertexdatas = NULL; + vertexdatas.Clear(); map->Seek(ML_VERTEXES); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index c16e03b3c..c574d189b 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -278,7 +278,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt, } } - for(int i = 0; i < numvertexdatas; i++) + for(unsigned i = 0; i < vertexdatas.Size(); i++) { int ii = oldvertextable == NULL ? i : oldvertextable[i]; @@ -296,9 +296,8 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt, } // If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed. - delete[] vertexdatas; - vertexdatas = NULL; - numvertexdatas = 0; + vertexdatas.Clear(); + vertexdatas.ShrinkToFit(); if (vt_found) { diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0284c0c23..b0c9dbc15 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -394,7 +394,6 @@ class UDMFParser : public UDMFParserBase TArray ParsedSideTextures; TArray ParsedSectors; TArray ParsedVertices; - TArray ParsedVertexDatas; FDynamicColormap *fogMap, *normMap; FMissingTextureTracker &missingTex; @@ -1996,7 +1995,7 @@ public: vertexdata_t vd; ParseVertex(&vt, &vd); ParsedVertices.Push(vt); - ParsedVertexDatas.Push(vd); + vertexdatas.Push(vd); } else { @@ -2014,11 +2013,6 @@ public: level.vertexes.Alloc(ParsedVertices.Size()); memcpy(&level.vertexes[0], &ParsedVertices[0], level.vertexes.Size() * sizeof(vertex_t)); - // Create the real vertex datas - numvertexdatas = ParsedVertexDatas.Size(); - vertexdatas = new vertexdata_t[numvertexdatas]; - memcpy(vertexdatas, &ParsedVertexDatas[0], numvertexdatas * sizeof(*vertexdatas)); - // Create the real sectors level.sectors.Alloc(ParsedSectors.Size()); memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t)); diff --git a/src/r_state.h b/src/r_state.h index aa5b46342..7151c0441 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -42,8 +42,7 @@ extern "C" int viewheight; extern TArray sprites; extern DWORD NumStdSprites; -extern int numvertexdatas; -extern vertexdata_t* vertexdatas; +extern TArray vertexdatas; extern int numsegs; extern seg_t* segs;