mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03: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:
@@ -32,7 +32,7 @@ void scriptclass::clearcustom(){
|
|||||||
customscripts.clear();
|
customscripts.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void scriptclass::tokenize( std::string t )
|
void scriptclass::tokenize( const std::string& t )
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
std::string tempword;
|
std::string tempword;
|
||||||
@@ -3725,7 +3725,7 @@ void scriptclass::hardreset()
|
|||||||
running = false;
|
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!
|
//this magic function breaks down the custom script and turns into real scripting!
|
||||||
std::string cscriptname="";
|
std::string cscriptname="";
|
||||||
|
|||||||
@@ -22,18 +22,18 @@ public:
|
|||||||
|
|
||||||
scriptclass();
|
scriptclass();
|
||||||
|
|
||||||
void load(std::string name);
|
void load(const std::string& name);
|
||||||
void loadother(const char* t);
|
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);
|
commands.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearcustom();
|
void clearcustom();
|
||||||
|
|
||||||
void tokenize(std::string t);
|
void tokenize(const std::string& t);
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
void scriptclass::load(std::string name)
|
void scriptclass::load(const std::string& name)
|
||||||
{
|
{
|
||||||
//loads script name t into the array
|
//loads script name t into the array
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user