1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Make std::string-using script funcs pass around const references

This makes it so that whenever a string is passed into these functions,
it's no longer needlessly copied.
This commit is contained in:
Misa 2020-07-04 16:01:35 -07:00 committed by Ethan Lee
parent d480c1011c
commit e6f3dab2e1
3 changed files with 7 additions and 7 deletions

View File

@ -32,7 +32,7 @@ void scriptclass::clearcustom(){
customscripts.clear();
}
void scriptclass::tokenize( std::string t )
void scriptclass::tokenize( const std::string& t )
{
j = 0;
std::string tempword;
@ -3725,7 +3725,7 @@ void scriptclass::hardreset()
running = false;
}
void scriptclass::loadcustom(std::string t)
void scriptclass::loadcustom(const std::string& t)
{
//this magic function breaks down the custom script and turns into real scripting!
std::string cscriptname="";

View File

@ -22,18 +22,18 @@ public:
scriptclass();
void load(std::string name);
void load(const std::string& name);
void loadother(const char* t);
void loadcustom(std::string t);
void loadcustom(const std::string& t);
void inline add(std::string t)
void inline add(const std::string& t)
{
commands.push_back(t);
}
void clearcustom();
void tokenize(std::string t);
void tokenize(const std::string& t);
void run();

View File

@ -1,7 +1,7 @@
#include "Script.h"
#include <SDL.h>
void scriptclass::load(std::string name)
void scriptclass::load(const std::string& name)
{
//loads script name t into the array
position = 0;