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

@@ -11,15 +11,10 @@ scriptclass::scriptclass()
//Start SDL
//Init
for (int init = 0; init < 500; init++)
{
commands.push_back(std::string());
}
for (int init = 0; init < 40; init++)
{
words.push_back(std::string());
txt.push_back(std::string());
}
commands.resize(500);
words.resize(40);
txt.resize(40);
position = 0;
scriptlength = 0;
scriptdelay = 0;