From be9c405ddd4c8aa0bf9df96378e0965224a8801f Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 29 Jun 2020 18:44:54 -0700 Subject: [PATCH] Use returns and don't have rest of loadcustomlevelstats in an 'else' This will cut down on unnecessary indentation levels. --- desktop_version/src/Game.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index de3121b7..9bd44867 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -580,17 +580,20 @@ void Game::updatecustomlevelstats(std::string clevel, int cscore) void Game::loadcustomlevelstats() { //testing - if(!customlevelstatsloaded) + if(customlevelstatsloaded) { + return; + } + tinyxml2::XMLDocument doc; if (!FILESYSTEM_loadTiXml2Document("saves/levelstats.vvv", doc)) { //No levelstats file exists; start new customlevelstats.clear(); savecustomlevelstats(); + return; } - else - { + // Old system std::vector customlevelnames; std::vector customlevelscores; @@ -689,8 +692,6 @@ void Game::loadcustomlevelstats() CustomLevelStat stat = {customlevelnames[i], customlevelscores[i]}; customlevelstats.push_back(stat); } - } - } } void Game::savecustomlevelstats()