1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00

Unindent from collapsing empty pText check

As always, the diff algorithms do terribly with unindentation, so I'm
doing the actual unindenting in this commit.
This commit is contained in:
Misa 2021-02-12 13:53:01 -08:00 committed by Ethan Lee
parent 8d5829dd26
commit ca973a6547
2 changed files with 47 additions and 47 deletions

View File

@ -446,11 +446,11 @@ void Game::updatecustomlevelstats(std::string clevel, int cscore)
if (pKey == #ARRAY_NAME && pText[0] != '\0') \
{ \
std::string TextString = pText; \
std::vector<std::string> values = split(TextString, ','); \
for (int i = 0; i < VVV_min(SDL_arraysize(DEST), values.size()); i++) \
{ \
DEST[i] = help.Int(values[i].c_str()); \
} \
std::vector<std::string> values = split(TextString, ','); \
for (int i = 0; i < VVV_min(SDL_arraysize(DEST), values.size()); i++) \
{ \
DEST[i] = help.Int(values[i].c_str()); \
} \
}
#define LOAD_ARRAY(ARRAY_NAME) LOAD_ARRAY_RENAME(ARRAY_NAME, ARRAY_NAME)
@ -542,11 +542,11 @@ void Game::loadcustomlevelstats()
if (pKey == "customlevelstats" && pText[0] != '\0')
{
std::string TextString = (pText);
std::vector<std::string> values = split(TextString,'|');
for(size_t i = 0; i < values.size(); i++)
{
customlevelnames.push_back(values[i]);
}
std::vector<std::string> values = split(TextString,'|');
for(size_t i = 0; i < values.size(); i++)
{
customlevelnames.push_back(values[i]);
}
}
}

View File

@ -1755,21 +1755,21 @@ bool editorclass::load(std::string& _path)
if (pKey == "contents" && pText[0] != '\0')
{
std::string TextString = (pText);
std::vector<std::string> values = split(TextString,',');
SDL_memset(contents, 0, sizeof(contents));
int x =0;
int y =0;
for(size_t i = 0; i < values.size(); i++)
std::vector<std::string> values = split(TextString,',');
SDL_memset(contents, 0, sizeof(contents));
int x =0;
int y =0;
for(size_t i = 0; i < values.size(); i++)
{
contents[x + (maxwidth*40*y)] = help.Int(values[i].c_str());
x++;
if(x == mapwidth*40)
{
contents[x + (maxwidth*40*y)] = help.Int(values[i].c_str());
x++;
if(x == mapwidth*40)
{
x=0;
y++;
}
x=0;
y++;
}
}
}
@ -1873,38 +1873,38 @@ bool editorclass::load(std::string& _path)
if (pKey == "script" && pText[0] != '\0')
{
std::string TextString = (pText);
std::vector<std::string> values = split(TextString,'|');
script.clearcustom();
Script script_;
bool headerfound = false;
for(size_t i = 0; i < values.size(); i++)
std::vector<std::string> values = split(TextString,'|');
script.clearcustom();
Script script_;
bool headerfound = false;
for(size_t i = 0; i < values.size(); i++)
{
std::string& line = values[i];
if(line.length() && line[line.length() - 1] == ':')
{
std::string& line = values[i];
if(line.length() && line[line.length() - 1] == ':')
{
if(headerfound)
{
//Add the script if we have a preceding header
script.customscripts.push_back(script_);
}
script_.name = line.substr(0, line.length()-1);
script_.contents.clear();
headerfound = true;
continue;
}
if(headerfound)
{
script_.contents.push_back(line);
//Add the script if we have a preceding header
script.customscripts.push_back(script_);
}
script_.name = line.substr(0, line.length()-1);
script_.contents.clear();
headerfound = true;
continue;
}
//Add the last script
if(headerfound)
{
//Add the script if we have a preceding header
script.customscripts.push_back(script_);
script_.contents.push_back(line);
}
}
//Add the last script
if(headerfound)
{
//Add the script if we have a preceding header
script.customscripts.push_back(script_);
}
}
}