mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-02-05 00:26:15 +03: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:
@@ -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_"){
|
||||||
|
|||||||
Reference in New Issue
Block a user