- replaced several explicit allocations with TArrays.
This commit is contained in:
parent
d68cd3aa80
commit
a73c065811
10 changed files with 66 additions and 115 deletions
|
|
@ -392,7 +392,7 @@ static void AddToVertex(const sector_t * sec, TArray<int> & list)
|
|||
|
||||
static void InitVertexData()
|
||||
{
|
||||
auto vt_sectorlists = new TArray<int>[level.vertexes.Size()];
|
||||
TArray<TArray<int>> vt_sectorlists(level.vertexes.Size(), true);
|
||||
|
||||
for(auto &line : level.lines)
|
||||
{
|
||||
|
|
@ -437,8 +437,6 @@ static void InitVertexData()
|
|||
vert.numsectors=0;
|
||||
}
|
||||
}
|
||||
|
||||
delete [] vt_sectorlists;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -478,15 +476,15 @@ static int segcmp(const void *a, const void *b)
|
|||
static void PrepareSegs()
|
||||
{
|
||||
auto numsides = level.sides.Size();
|
||||
int *segcount = new int[numsides];
|
||||
TArray<int> segcount(numsides, true);
|
||||
int realsegs = 0;
|
||||
|
||||
// count the segs
|
||||
memset(segcount, 0, numsides * sizeof(int));
|
||||
memset(segcount.Data(), 0, numsides * sizeof(int));
|
||||
|
||||
for(auto &seg : level.segs)
|
||||
{
|
||||
if (seg.sidedef == NULL) continue; // miniseg
|
||||
if (seg.sidedef == nullptr) continue; // miniseg
|
||||
int sidenum = seg.sidedef->Index();
|
||||
|
||||
realsegs++;
|
||||
|
|
@ -509,7 +507,6 @@ static void PrepareSegs()
|
|||
level.sides[i].segs = level.sides[i-1].segs + segcount[i-1];
|
||||
level.sides[i].numsegs = 0;
|
||||
}
|
||||
delete [] segcount;
|
||||
|
||||
// assign the segs
|
||||
for (auto &seg : level.segs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue