diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 7e3666100..d7c3ad770 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -432,6 +432,7 @@ public: TArray vertexes; TArray sectors; + TArray extsectors; // container for non-trivial sector information. sector_t must be trivially copyable for *_fakeflat to work as intended. TArray linebuffer; // contains the line lists for the sectors. TArray subsectorbuffer; // contains the subsector lists for the sectors. TArray lines; diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 1d008f6b3..779e901a6 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -1066,6 +1066,7 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex) unsigned numsectors = lumplen / sizeof(mapsector_t); Level->sectors.Alloc(numsectors); + Level->extsectors.Alloc(numsectors); auto sectors = &Level->sectors[0]; memset (sectors, 0, numsectors*sizeof(sector_t)); @@ -1078,12 +1079,9 @@ void MapLoader::LoadSectors (MapData *map, FMissingTextureTracker &missingtex) ms = (mapsector_t*)msp.Data(); ss = sectors; - // Extended properties - sectors[0].e = new extsector_t[numsectors]; - for (unsigned i = 0; i < numsectors; i++, ss++, ms++) { - ss->e = §ors[0].e[i]; + ss->e = &Level->extsectors[i]; ss->Level = Level; if (!map->HasBehavior) ss->Flags |= SECF_FLOORDROP; ss->SetPlaneTexZ(sector_t::floor, (double)LittleShort(ms->floorheight)); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 3f1520d55..785d43df2 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -314,11 +314,6 @@ void FLevelLocals::ClearLevelData() DialogueRoots.Clear(); ClassRoots.Clear(); - // delete allocated data in the level arrays. - if (sectors.Size() > 0) - { - delete[] sectors[0].e; - } for (auto &sub : subsectors) { if (sub.BSP != nullptr) delete sub.BSP; @@ -335,6 +330,7 @@ void FLevelLocals::ClearLevelData() canvasTextureInfo.EmptyList(); sections.Clear(); segs.Clear(); + extsectors.Clear(); sectors.Clear(); linebuffer.Clear(); subsectorbuffer.Clear();