mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Remove reference from customlevelclass::load
arg
For some reason, originally, this function mutated the std::string passed into it by reference. So calling the function could potentially mutate whatever got passed in, and callers potentially could have relied on that behavior. Now that the surrounding callsites have all been cleaned up, though (especially scriptclass::startgamemode), it's clear that it's only used in two places: Loading the level in the editor, and loading the level in live gameplay. In both cases, the passed-in string isn't used ever again afterwards. So, it's safe to delete the mutable reference without any undesirable effects, making the code cleaner and easier to understand. The function now mutates a copy instead of mutating whatever the caller has.
This commit is contained in:
parent
79f5e7a05c
commit
acfa085fd1
2 changed files with 2 additions and 2 deletions
|
@ -987,7 +987,7 @@ int customlevelclass::findwarptoken(int t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool customlevelclass::load(std::string& _path)
|
bool customlevelclass::load(std::string _path)
|
||||||
{
|
{
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
tinyxml2::XMLHandle hDoc(&doc);
|
tinyxml2::XMLHandle hDoc(&doc);
|
||||||
|
|
|
@ -137,7 +137,7 @@ public:
|
||||||
|
|
||||||
int absfree(int x, int y);
|
int absfree(int x, int y);
|
||||||
|
|
||||||
bool load(std::string& _path);
|
bool load(std::string _path);
|
||||||
#ifndef NO_EDITOR
|
#ifndef NO_EDITOR
|
||||||
bool save(const std::string& _path);
|
bool save(const std::string& _path);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue