1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-04 18:29:41 +01: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:
Misa 2020-06-11 17:41:51 -07:00 committed by Ethan Lee
parent 7150c9ef2d
commit eb5fb3dff5

View file

@ -3,8 +3,6 @@
#include "Script.h"
#include <algorithm>
void scriptclass::load(std::string t)
{
//loads script name t into the array
@ -12,10 +10,9 @@ void scriptclass::load(std::string t)
commands.clear();
running = true;
int maxlength = (std::min(int(t.length()),7));
std::string customstring="";
for(int i=0; i<maxlength; i++){
customstring+=t[i];
if(t.length()){
customstring=t.substr(0, 7);
}
if (customstring == "custom_"){