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

Clean up resetting editor contents and scripts

Contents and scripts should be reset in editorclass::reset(); there's no
reason to reset them again right before you load them from an XML file
in editorclass::load().

Additionally, the resets now consistently use SDL_zeroa() (for contents)
and scriptclass::clearcustom() (for scripts).
This commit is contained in:
Misa 2021-02-12 16:35:22 -08:00 committed by Ethan Lee
parent fe77ada160
commit a113662050
2 changed files with 4 additions and 11 deletions

View File

@ -35,7 +35,8 @@ scriptclass::scriptclass()
texty = 0;
}
void scriptclass::clearcustom(){
void scriptclass::clearcustom()
{
customscripts.clear();
}

View File

@ -364,13 +364,7 @@ void editorclass::reset()
}
}
for (int j = 0; j < 30 * maxheight; j++)
{
for (int i = 0; i < 40 * maxwidth; i++)
{
contents[i+(j*40*maxwidth)]=0;
}
}
SDL_zeroa(contents);
hooklist.clear();
@ -387,7 +381,7 @@ void editorclass::reset()
hookmenupage=0;
hookmenu=0;
script.customscripts.clear();
script.clearcustom();
returneditoralpha = 0;
oldreturneditoralpha = 0;
@ -1756,7 +1750,6 @@ bool editorclass::load(std::string& _path)
{
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++)
@ -1874,7 +1867,6 @@ bool editorclass::load(std::string& _path)
{
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++)