From 0be8586135a2f4e7e79388266b5ed7736d01faf1 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Wed, 7 Sep 2016 01:24:48 +0100 Subject: [PATCH] Improve indentation of loadLevelFile --- rwengine/src/engine/GameData.cpp | 77 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/rwengine/src/engine/GameData.cpp b/rwengine/src/engine/GameData.cpp index 776277f4..b2cef574 100644 --- a/rwengine/src/engine/GameData.cpp +++ b/rwengine/src/engine/GameData.cpp @@ -73,48 +73,47 @@ void GameData::loadLevelFile(const std::string& path) if(!datfile.is_open()) { logger->error("Data", "Failed to open game file " + path); + return; } - else - { - for(std::string line, cmd; std::getline(datfile, line);) - { - if(line.size() == 0 || line[0] == '#') continue; - #ifndef RW_WINDOWS - line.erase(line.size()-1); - #endif - size_t space = line.find_first_of(' '); - if(space != line.npos) + for(std::string line, cmd; std::getline(datfile, line);) + { + if(line.size() == 0 || line[0] == '#') continue; + #ifndef RW_WINDOWS + line.erase(line.size()-1); + #endif + + size_t space = line.find_first_of(' '); + if(space != line.npos) + { + cmd = line.substr(0, space); + if(cmd == "IDE") { - cmd = line.substr(0, space); - if(cmd == "IDE") - { - auto path = line.substr(space+1); - loadIDE(path); - } - else if(cmd == "SPLASH") - { - splash = line.substr(space+1); - } - else if(cmd == "COLFILE") - { - int zone = atoi(line.substr(space+1,1).c_str()); - auto path = line.substr(space+3); - loadCOL(zone, path); - } - else if(cmd == "IPL") - { - auto path = line.substr(space+1); - loadIPL(path); - } - else if(cmd == "TEXDICTION") - { - auto path = line.substr(space+1); - /// @todo improve TXD handling - auto name = index.findFilePath(path).filename().native(); - std::transform(name.begin(), name.end(), name.begin(), ::tolower); - loadTXD(name); - } + auto path = line.substr(space+1); + loadIDE(path); + } + else if(cmd == "SPLASH") + { + splash = line.substr(space+1); + } + else if(cmd == "COLFILE") + { + int zone = atoi(line.substr(space+1,1).c_str()); + auto path = line.substr(space+3); + loadCOL(zone, path); + } + else if(cmd == "IPL") + { + auto path = line.substr(space+1); + loadIPL(path); + } + else if(cmd == "TEXDICTION") + { + auto path = line.substr(space+1); + /// @todo improve TXD handling + auto name = index.findFilePath(path).filename().native(); + std::transform(name.begin(), name.end(), name.begin(), ::tolower); + loadTXD(name); } } }