1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-05 02:39:41 +01: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') \ if (pKey == #ARRAY_NAME && pText[0] != '\0') \
{ \ { \
std::string TextString = pText; \ std::string TextString = pText; \
std::vector<std::string> values = split(TextString, ','); \ std::vector<std::string> values = split(TextString, ','); \
for (int i = 0; i < VVV_min(SDL_arraysize(DEST), values.size()); i++) \ for (int i = 0; i < VVV_min(SDL_arraysize(DEST), values.size()); i++) \
{ \ { \
DEST[i] = help.Int(values[i].c_str()); \ DEST[i] = help.Int(values[i].c_str()); \
} \ } \
} }
#define LOAD_ARRAY(ARRAY_NAME) LOAD_ARRAY_RENAME(ARRAY_NAME, ARRAY_NAME) #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') if (pKey == "customlevelstats" && pText[0] != '\0')
{ {
std::string TextString = (pText); std::string TextString = (pText);
std::vector<std::string> values = split(TextString,'|'); std::vector<std::string> values = split(TextString,'|');
for(size_t i = 0; i < values.size(); i++) for(size_t i = 0; i < values.size(); i++)
{ {
customlevelnames.push_back(values[i]); customlevelnames.push_back(values[i]);
} }
} }
} }

View file

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