1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Use returns and don't have rest of loadcustomlevelstats in an 'else'

This will cut down on unnecessary indentation levels.
This commit is contained in:
Misa 2020-06-29 18:44:54 -07:00
parent 9a008dc77c
commit be9c405ddd

View file

@ -580,17 +580,20 @@ void Game::updatecustomlevelstats(std::string clevel, int cscore)
void Game::loadcustomlevelstats() void Game::loadcustomlevelstats()
{ {
//testing //testing
if(!customlevelstatsloaded) if(customlevelstatsloaded)
{ {
return;
}
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXml2Document("saves/levelstats.vvv", doc)) if (!FILESYSTEM_loadTiXml2Document("saves/levelstats.vvv", doc))
{ {
//No levelstats file exists; start new //No levelstats file exists; start new
customlevelstats.clear(); customlevelstats.clear();
savecustomlevelstats(); savecustomlevelstats();
return;
} }
else
{
// Old system // Old system
std::vector<std::string> customlevelnames; std::vector<std::string> customlevelnames;
std::vector<int> customlevelscores; std::vector<int> customlevelscores;
@ -689,8 +692,6 @@ void Game::loadcustomlevelstats()
CustomLevelStat stat = {customlevelnames[i], customlevelscores[i]}; CustomLevelStat stat = {customlevelnames[i], customlevelscores[i]};
customlevelstats.push_back(stat); customlevelstats.push_back(stat);
} }
}
}
} }
void Game::savecustomlevelstats() void Game::savecustomlevelstats()