mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user