diff --git a/desktop_version/src/CustomLevels.cpp b/desktop_version/src/CustomLevels.cpp index 1da79475..3fccdd8b 100644 --- a/desktop_version/src/CustomLevels.cpp +++ b/desktop_version/src/CustomLevels.cpp @@ -246,7 +246,7 @@ void customlevelclass::getDirectoryData(void) } } -bool customlevelclass::getLevelMetaData(std::string& _path, LevelMetaData& _data ) +bool customlevelclass::getLevelMetaData(const std::string& _path, LevelMetaData& _data ) { unsigned char *uMem; FILESYSTEM_loadFileToMemory(_path.c_str(), &uMem, NULL, true); @@ -1264,7 +1264,7 @@ fail: } #ifndef NO_EDITOR -bool customlevelclass::save(std::string& _path) +bool customlevelclass::save(const std::string& _path) { tinyxml2::XMLDocument doc; diff --git a/desktop_version/src/CustomLevels.h b/desktop_version/src/CustomLevels.h index 9e0871ce..f137c870 100644 --- a/desktop_version/src/CustomLevels.h +++ b/desktop_version/src/CustomLevels.h @@ -80,7 +80,7 @@ public: void loadZips(void); void getDirectoryData(void); - bool getLevelMetaData(std::string& filename, LevelMetaData& _data ); + bool getLevelMetaData(const std::string& filename, LevelMetaData& _data ); void reset(void); const int* loadlevel(int rxi, int ryi); @@ -117,7 +117,7 @@ public: bool load(std::string& _path); #ifndef NO_EDITOR - bool save(std::string& _path); + bool save(const std::string& _path); #endif void generatecustomminimap(void); diff --git a/desktop_version/src/Editor.cpp b/desktop_version/src/Editor.cpp index 8aa8e99b..9429c18d 100644 --- a/desktop_version/src/Editor.cpp +++ b/desktop_version/src/Editor.cpp @@ -122,7 +122,7 @@ void editorclass::gethooks(void) } } -void editorclass::loadhookineditor(std::string t) +void editorclass::loadhookineditor(const std::string& t) { //Find hook t in the scriptclass, then load it into the editor clearscriptbuffer(); @@ -145,7 +145,7 @@ void editorclass::loadhookineditor(std::string t) } } -void editorclass::addhooktoscript(std::string t) +void editorclass::addhooktoscript(const std::string& t) { //Adds hook+the scriptbuffer to the end of the scriptclass removehookfromscript(t); @@ -155,7 +155,7 @@ void editorclass::addhooktoscript(std::string t) script.customscripts.push_back(script_); } -void editorclass::removehookfromscript(std::string t) +void editorclass::removehookfromscript(const std::string& t) { /* Find hook t in the scriptclass, then removes it (and any other code with it) * When this loop reaches the end, it wraps to SIZE_MAX; SIZE_MAX + 1 is 0 */ @@ -169,7 +169,7 @@ void editorclass::removehookfromscript(std::string t) } } -void editorclass::removehook(std::string t) +void editorclass::removehook(const std::string& t) { //Check the hooklist for the hook t. If it's there, remove it from here and the script size_t i; @@ -184,7 +184,7 @@ void editorclass::removehook(std::string t) } } -void editorclass::addhook(std::string t) +void editorclass::addhook(const std::string& t) { //Add an empty function to the list in both editor and script removehook(t); @@ -192,7 +192,7 @@ void editorclass::addhook(std::string t) addhooktoscript(t); } -bool editorclass::checkhook(std::string t) +bool editorclass::checkhook(const std::string& t) { //returns true if hook t already is in the list for(size_t i=0; i hooklist; int hookmenupage, hookmenu; diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 22ad396e..3b0310f3 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5012,7 +5012,7 @@ void Game::readmaingamesave(const char* savename, tinyxml2::XMLDocument& doc) } -void Game::customloadquick(std::string savfile) +void Game::customloadquick(const std::string& savfile) { tinyxml2::XMLDocument doc; tinyxml2::XMLHandle hDoc(&doc); @@ -5541,7 +5541,7 @@ std::string Game::writemaingamesave(tinyxml2::XMLDocument& doc) } -bool Game::customsavequick(std::string savfile) +bool Game::customsavequick(const std::string& savfile) { const std::string levelfile = savfile.substr(7); diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 07493cf7..6a437ac7 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -121,7 +121,7 @@ public: void resetgameclock(void); - bool customsavequick(std::string savfile); + bool customsavequick(const std::string& savfile); bool savequick(void); void gameclock(void); @@ -196,7 +196,7 @@ public: void deathsequence(void); - void customloadquick(std::string savfile); + void customloadquick(const std::string& savfile); void loadquick(void); void customdeletequick(const std::string& file); diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 4087b679..6441b4cf 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -545,11 +545,11 @@ void Graphics::do_print( } } -void Graphics::Print( int _x, int _y, std::string _s, int r, int g, int b, bool cen /*= false*/ ) { +void Graphics::Print( int _x, int _y, const std::string& _s, int r, int g, int b, bool cen /*= false*/ ) { return PrintAlpha(_x,_y,_s,r,g,b,255,cen); } -void Graphics::PrintAlpha( int _x, int _y, std::string _s, int r, int g, int b, int a, bool cen /*= false*/ ) +void Graphics::PrintAlpha( int _x, int _y, const std::string& _s, int r, int g, int b, int a, bool cen /*= false*/ ) { if (cen) _x = ((160 ) - ((len(_s)) / 2)); @@ -671,7 +671,7 @@ void Graphics::PrintWrap( } -void Graphics::bigprint( int _x, int _y, std::string _s, int r, int g, int b, bool cen, int sc ) +void Graphics::bigprint( int _x, int _y, const std::string& _s, int r, int g, int b, bool cen, int sc ) { if (cen) { @@ -681,7 +681,7 @@ void Graphics::bigprint( int _x, int _y, std::string _s, int r, int g, int b, b return do_print(_x, _y, _s, r, g, b, 255, sc); } -void Graphics::bigbprint(int x, int y, std::string s, int r, int g, int b, bool cen, int sc) +void Graphics::bigbprint(int x, int y, const std::string& s, int r, int g, int b, bool cen, int sc) { if (!notextoutline) { @@ -703,10 +703,10 @@ void Graphics::bigbprint(int x, int y, std::string s, int r, int g, int b, bool bigprint(x, y, s, r, g, b, cen, sc); } -int Graphics::len(std::string t) +int Graphics::len(const std::string& t) { int bfontpos = 0; - std::string::iterator iter = t.begin(); + std::string::const_iterator iter = t.begin(); while (iter != t.end()) { int cur = utf8::unchecked::next(iter); bfontpos += bfontlen(cur); @@ -714,11 +714,11 @@ int Graphics::len(std::string t) return bfontpos; } -void Graphics::bprint( int x, int y, std::string t, int r, int g, int b, bool cen /*= false*/ ) { +void Graphics::bprint( int x, int y, const std::string& t, int r, int g, int b, bool cen /*= false*/ ) { bprintalpha(x,y,t,r,g,b,255,cen); } -void Graphics::bprintalpha( int x, int y, std::string t, int r, int g, int b, int a, bool cen /*= false*/ ) +void Graphics::bprintalpha( int x, int y, const std::string& t, int r, int g, int b, int a, bool cen /*= false*/ ) { if (!notextoutline) { @@ -1370,7 +1370,7 @@ void Graphics::textboxtimer( int t ) textbox[m].timer=t; } -void Graphics::addline( std::string t ) +void Graphics::addline( const std::string& t ) { if (!INBOUNDS_VEC(m, textbox)) { @@ -1394,7 +1394,7 @@ void Graphics::textboxadjust(void) void Graphics::createtextboxreal( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -1420,7 +1420,7 @@ void Graphics::createtextboxreal( } void Graphics::createtextbox( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -1431,7 +1431,7 @@ void Graphics::createtextbox( } void Graphics::createtextboxflipme( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -3184,7 +3184,7 @@ void Graphics::renderfixedpost(void) } } -void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen, float sc) +void Graphics::bigrprint(int x, int y, const std::string& t, int r, int g, int b, bool cen, float sc) { x = x / (sc); @@ -3202,7 +3202,7 @@ void Graphics::bigrprint(int x, int y, std::string& t, int r, int g, int b, bool return do_print(x, y, t, r, g, b, 255, sc); } -void Graphics::bigbrprint(int x, int y, std::string& s, int r, int g, int b, bool cen, float sc) +void Graphics::bigbrprint(int x, int y, const std::string& s, int r, int g, int b, bool cen, float sc) { if (!notextoutline) { diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index d64de153..f5bcafd9 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -52,7 +52,7 @@ public: void setwarprect(int a, int b, int c, int d); void createtextboxreal( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -61,7 +61,7 @@ public: bool flipme ); void createtextbox( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -69,7 +69,7 @@ public: int b ); void createtextboxflipme( - std::string t, + const std::string& t, int xp, int yp, int r, @@ -87,7 +87,7 @@ public: void textboxadjust(void); - void addline(std::string t); + void addline(const std::string& t); void textboxtimer(int t); @@ -133,9 +133,9 @@ public: void do_print(int x, int y, const std::string& text, int r, int g, int b, int a, int scale); - void Print(int _x, int _y, std::string _s, int r, int g, int b, bool cen = false); + void Print(int _x, int _y, const std::string& _s, int r, int g, int b, bool cen = false); - void PrintAlpha(int _x, int _y, std::string _s, int r, int g, int b, int a, bool cen = false); + void PrintAlpha(int _x, int _y, const std::string& _s, int r, int g, int b, int a, bool cen = false); bool next_wrap(size_t* start, size_t* len, const char* str, int maxwidth); @@ -143,13 +143,13 @@ public: void PrintWrap(int x, int y, const char* str, int r, int g, int b, bool cen, int linespacing, int maxwidth); - void bprint(int x, int y, std::string t, int r, int g, int b, bool cen = false); + void bprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false); - void bprintalpha(int x, int y, std::string t, int r, int g, int b, int a, bool cen = false); + void bprintalpha(int x, int y, const std::string& t, int r, int g, int b, int a, bool cen = false); - int len(std::string t); - void bigprint( int _x, int _y, std::string _s, int r, int g, int b, bool cen = false, int sc = 2 ); - void bigbprint(int x, int y, std::string s, int r, int g, int b, bool cen = false, int sc = 2); + int len(const std::string& t); + void bigprint( int _x, int _y, const std::string& _s, int r, int g, int b, bool cen = false, int sc = 2 ); + void bigbprint(int x, int y, const std::string& s, int r, int g, int b, bool cen = false, int sc = 2); void drawspritesetcol(int x, int y, int t, int c); @@ -173,8 +173,8 @@ public: void drawtrophytext(void); - void bigrprint(int x, int y, std::string& t, int r, int g, int b, bool cen = false, float sc = 2); - void bigbrprint(int x, int y, std::string& t, int r, int g, int b, bool cen = false, float sc = 2); + void bigrprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false, float sc = 2); + void bigbrprint(int x, int y, const std::string& t, int r, int g, int b, bool cen = false, float sc = 2); void drawtele(int x, int y, int t, Uint32 c); diff --git a/desktop_version/src/Textbox.cpp b/desktop_version/src/Textbox.cpp index 797a7b3c..73e7f0c5 100644 --- a/desktop_version/src/Textbox.cpp +++ b/desktop_version/src/Textbox.cpp @@ -107,7 +107,7 @@ void textboxclass::resize(void) h = (line.size() + 2) * 8; } -void textboxclass::addline(std::string t) +void textboxclass::addline(const std::string& t) { line.push_back(t); resize(); diff --git a/desktop_version/src/Textbox.h b/desktop_version/src/Textbox.h index f319927e..e9ad48ed 100644 --- a/desktop_version/src/Textbox.h +++ b/desktop_version/src/Textbox.h @@ -25,7 +25,7 @@ public: void resize(void); - void addline(std::string t); + void addline(const std::string& t); public: //Fundamentals std::vector line;