Simplify std::vector initializations

Resizing the vector does the same thing that the loops did, it changes
the size for the vector and initializes it with default-constructed
elements (or 0 or its equivalent for POD types).

Where a specific value is needed, it is set with the second
parameter of resize().
This commit is contained in:
Marvin Scholz
2020-01-12 12:28:34 +01:00
committed by Ethan Lee
parent 882da7de28
commit 64fd50be6f
3 changed files with 22 additions and 59 deletions

View File

@@ -73,28 +73,13 @@ void entityclass::init()
customcrewmoods[i]=1;
}
for (int i = 0; i < 100; i++)
{
int t =0;
flags.push_back(t);
}
flags.resize(100);
blocks.resize(500);
entities.resize(200);
linecrosskludge.resize(100);
collect.resize(100);
customcollect.resize(100);
for (int i = 0; i < 500; i++)
{
blocks.push_back(blockclass());
}
for (int z = 0; z < 200; z++)
{
entities.push_back(entclass());
}
for (int i = 0; i < 100; i++)
{
linecrosskludge.push_back(entclass());
collect.push_back(0);
customcollect.push_back(0);
}
nlinecrosskludge = 0;
}