mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-09-29 17:57:23 +02:00
Refactor customstring calculation in scriptclass::load()
The previous way manually concatenated the first 7 characters of the string together (and had an std::min() calculation). The new way instead does std::string::substr(), which is much more snappy.
This commit is contained in:
parent
7150c9ef2d
commit
eb5fb3dff5
1 changed files with 2 additions and 5 deletions
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
void scriptclass::load(std::string t)
|
void scriptclass::load(std::string t)
|
||||||
{
|
{
|
||||||
//loads script name t into the array
|
//loads script name t into the array
|
||||||
|
@ -12,10 +10,9 @@ void scriptclass::load(std::string t)
|
||||||
commands.clear();
|
commands.clear();
|
||||||
running = true;
|
running = true;
|
||||||
|
|
||||||
int maxlength = (std::min(int(t.length()),7));
|
|
||||||
std::string customstring="";
|
std::string customstring="";
|
||||||
for(int i=0; i<maxlength; i++){
|
if(t.length()){
|
||||||
customstring+=t[i];
|
customstring=t.substr(0, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (customstring == "custom_"){
|
if (customstring == "custom_"){
|
||||||
|
|
Loading…
Reference in a new issue