1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Remove semi-useless function editorclass::weirdloadthing()

Looks like this function was created because editorclass::load() takes
in a string by reference, not by value, and thus mutates it afterwards,
so if you passed a string in when you didn't want it to be mutated, bad
things would happen.

However, a better workaround for the above issue would simply to
duplicate the string and pass that string instead, thus the original
string wouldn't be affected.
This commit is contained in:
Misa 2020-04-02 13:15:00 -07:00 committed by Ethan Lee
parent 5ba1cf7571
commit 1310896191
3 changed files with 8 additions and 11 deletions

View file

@ -3221,9 +3221,11 @@ void scriptclass::startgamemode( int t )
//load("intro"); //load("intro");
break; break;
case 22: //play custom level (in game) case 22: //play custom level (in game)
{
//Initilise the level //Initilise the level
//First up, find the start point //First up, find the start point
ed.weirdloadthing(ed.ListOfMetaData[game.playcustomlevel].filename); std::string filename = std::string(ed.ListOfMetaData[game.playcustomlevel].filename);
ed.load(filename);
ed.findstartpoint(); ed.findstartpoint();
game.gamestate = GAMEMODE; game.gamestate = GAMEMODE;
@ -3263,10 +3265,13 @@ void scriptclass::startgamemode( int t )
graphics.fademode = 4; graphics.fademode = 4;
//load("intro"); //load("intro");
break; break;
}
case 23: //Continue in custom level case 23: //Continue in custom level
{
//Initilise the level //Initilise the level
//First up, find the start point //First up, find the start point
ed.weirdloadthing(ed.ListOfMetaData[game.playcustomlevel].filename); std::string filename = std::string(ed.ListOfMetaData[game.playcustomlevel].filename);
ed.load(filename);
ed.findstartpoint(); ed.findstartpoint();
game.gamestate = GAMEMODE; game.gamestate = GAMEMODE;
@ -3309,6 +3314,7 @@ void scriptclass::startgamemode( int t )
graphics.fademode = 4; graphics.fademode = 4;
//load("intro"); //load("intro");
break; break;
}
#endif #endif
case 100: case 100:
game.savestats(); game.savestats();

View file

@ -344,14 +344,6 @@ void editorclass::reset()
returneditoralpha = 0; returneditoralpha = 0;
} }
void editorclass::weirdloadthing(std::string t)
{
//Stupid pointless function because I hate C++ and everything to do with it
//It's even stupider now that I don't need to append .vvvvvv anymore! bah, whatever
//t=t+".vvvvvv";
load(t);
}
void editorclass::gethooks() void editorclass::gethooks()
{ {
//Scan through the script and create a hooks list based on it //Scan through the script and create a hooks list based on it

View file

@ -140,7 +140,6 @@ class editorclass{
int findwarptoken(int t); int findwarptoken(int t);
void countstuff(); void countstuff();
void findstartpoint(); void findstartpoint();
void weirdloadthing(std::string t);
int getlevelcol(int t); int getlevelcol(int t);
int getenemycol(int t); int getenemycol(int t);
int entcol; int entcol;