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:
parent
7150c9ef2d
commit
eb5fb3dff5
1 changed files with 2 additions and 5 deletions
|
@ -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_"){
|
||||
|
|
Loading…
Reference in a new issue