diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 649ed04329..ad38081a90 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -103,7 +103,6 @@ #include "fragglescript/t_fs.h" #include "maploader.h" -sidei_t *sidetemp; TArray MapThingsConverted; bool ForceNodeBuild; @@ -1830,7 +1829,7 @@ void MapLoader::LoadLineDefs2 (MapData * map) Level->sides.Alloc(count); memset(&Level->sides[0], 0, count * sizeof(side_t)); - sidetemp = new sidei_t[MAX(count, Level->vertexes.Size())]; + sidetemp.Resize(MAX(count, Level->vertexes.Size())); for (i = 0; i < count; i++) { sidetemp[i].a.special = sidetemp[i].a.tag = 0; @@ -1857,12 +1856,8 @@ void MapLoader::LoopSidedefs (bool firstloop) { int i; - if (sidetemp != nullptr) - { - delete[] sidetemp; - } int numsides = Level->sides.Size(); - sidetemp = new sidei_t[MAX(Level->vertexes.Size(), numsides)]; + sidetemp.Resize(MAX(Level->vertexes.Size(), numsides)); for (i = 0; i < (int)Level->vertexes.Size(); ++i) { @@ -3231,8 +3226,4 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position) PO_Init(); // Initialize the polyobjs if (!Level->IsReentering()) P_FinalizePortals(); // finalize line portals after polyobjects have been initialized. This info is needed for properly flagging them. - - assert(sidetemp != nullptr); - delete[] sidetemp; - sidetemp = nullptr; } diff --git a/src/maploader/maploader.h b/src/maploader/maploader.h index 30e0e498eb..b9ed0f2f86 100644 --- a/src/maploader/maploader.h +++ b/src/maploader/maploader.h @@ -59,6 +59,27 @@ struct EDSector double Overlayalpha[2]; }; +struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init +{ + union + { + // Used when unpacking sidedefs and assigning + // properties based on linedefs. + struct + { + short tag, special; + short alpha; + uint32_t map; + } a; + + // Used when grouping sidedefs into loops. + struct + { + uint32_t first, next; + char lineside; + } b; + }; +}; struct FMissingCount { @@ -83,6 +104,7 @@ class MapLoader TArray MapThingsUserData; int sidecount = 0; TArray linemap; + TArray sidetemp; // Extradata loader TMap EDLines; diff --git a/src/maploader/polyobjects.cpp b/src/maploader/polyobjects.cpp index 2bb54a969d..83ab246d77 100644 --- a/src/maploader/polyobjects.cpp +++ b/src/maploader/polyobjects.cpp @@ -117,7 +117,7 @@ void MapLoader::IterFindPolySides (FPolyObj *po, side_t *side) static TArray vnum; unsigned int vnumat; - assert(sidetemp != NULL); + assert(sidetemp.Size() > 0); vnum.Clear(); vnum.Push(uint32_t(side->V1()->Index())); diff --git a/src/p_setup.h b/src/p_setup.h index 1b237e657b..5973a4fcb2 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -170,28 +170,6 @@ void ReportUnpairedMinisegs(); // To be moved to maploader later! -struct sidei_t // [RH] Only keep BOOM sidedef init stuff around for init -{ - union - { - // Used when unpacking sidedefs and assigning - // properties based on linedefs. - struct - { - short tag, special; - short alpha; - uint32_t map; - } a; - - // Used when grouping sidedefs into loops. - struct - { - uint32_t first, next; - char lineside; - } b; - }; -}; -extern sidei_t *sidetemp; extern TArray MapThingsConverted; extern bool ForceNodeBuild;