From eb5fb3dff5fcaf7854bd31a650f92cbe19b06281 Mon Sep 17 00:00:00 2001 From: Misa Date: Thu, 11 Jun 2020 17:41:51 -0700 Subject: [PATCH] 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. --- desktop_version/src/Scripts.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/desktop_version/src/Scripts.cpp b/desktop_version/src/Scripts.cpp index 65aac0bd..e35bcd24 100644 --- a/desktop_version/src/Scripts.cpp +++ b/desktop_version/src/Scripts.cpp @@ -3,8 +3,6 @@ #include "Script.h" -#include - 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