1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-03 09:09:47 +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())
{
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);
}
}
}