1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Improve indentation of loadLevelFile

This commit is contained in:
Daniel Evans 2016-09-07 01:24:48 +01:00
parent 930e10ce16
commit 0be8586135

View File

@ -73,48 +73,47 @@ void GameData::loadLevelFile(const std::string& path)
if(!datfile.is_open()) if(!datfile.is_open())
{ {
logger->error("Data", "Failed to open game file " + path); 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(' '); for(std::string line, cmd; std::getline(datfile, line);)
if(space != line.npos) {
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); auto path = line.substr(space+1);
if(cmd == "IDE") loadIDE(path);
{ }
auto path = line.substr(space+1); else if(cmd == "SPLASH")
loadIDE(path); {
} splash = line.substr(space+1);
else if(cmd == "SPLASH") }
{ else if(cmd == "COLFILE")
splash = line.substr(space+1); {
} int zone = atoi(line.substr(space+1,1).c_str());
else if(cmd == "COLFILE") auto path = line.substr(space+3);
{ loadCOL(zone, path);
int zone = atoi(line.substr(space+1,1).c_str()); }
auto path = line.substr(space+3); else if(cmd == "IPL")
loadCOL(zone, path); {
} auto path = line.substr(space+1);
else if(cmd == "IPL") loadIPL(path);
{ }
auto path = line.substr(space+1); else if(cmd == "TEXDICTION")
loadIPL(path); {
} auto path = line.substr(space+1);
else if(cmd == "TEXDICTION") /// @todo improve TXD handling
{ auto name = index.findFilePath(path).filename().native();
auto path = line.substr(space+1); std::transform(name.begin(), name.end(), name.begin(), ::tolower);
/// @todo improve TXD handling loadTXD(name);
auto name = index.findFilePath(path).filename().native();
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
loadTXD(name);
}
} }
} }
} }