diff --git a/ZSharp/Main.cpp b/ZSharp/Main.cpp index d9f56c6..24b673d 100644 --- a/ZSharp/Main.cpp +++ b/ZSharp/Main.cpp @@ -151,7 +151,7 @@ boost::any EvalExpression(const string& ex, unordered_map& v #endif vector argList = splitNoOverlap(insideFunArgs, ',', '(', ')'); #if DEVELOPER_MESSAGES == true - cout << "["< funcArgs = VarValues(argList, variableValues); return ExecuteFunction(trim(split(expression, '(')[0]), funcArgs); @@ -240,8 +240,8 @@ boost::any EvalExpression(const string& ex, unordered_map& v else { newExpression += expression[i]; + } } -} #if DEVELOPER_MESSAGES == true //InterpreterLog(" new expression: |" + newExpression + "|"); #endif @@ -448,6 +448,7 @@ boost::any ProcessLine(const vector>& words, int& lineNum, unorde // re-inits a variable then store it with it's value else if (countInVector(types, trim(words.at(lineNum).at(0))) > 0) { + //cout << words.at(lineNum).at(1) << "=" << unWrapVec(slice(words.at(lineNum), 3, -1)) << "=" << AnyAsString(EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues)) << endl; variableValues[words.at(lineNum).at(1)] = EvalExpression(unWrapVec(slice(words.at(lineNum), 3, -1)), variableValues); return nullType; } @@ -621,7 +622,7 @@ boost::any ExecuteFunction(const string& functionName, const vector& cout << functionName + " \x1B[33m" << funcArgs[i] << " == " << AnyAsString(inputVarVals[i]) << "\033[0m\t\t" << endl; #endif } -} + } //Iterate through all lines in function for (int lineNum = 1; lineNum < (int)words.size(); lineNum++) @@ -696,7 +697,7 @@ int parseZSharp(string script) functionContents.push_back(removeTabs(words.at(p), 1)); } functionValues[functName] = functionContents; - } + } else { if (words.at(lineNum).at(0) == "include") @@ -755,8 +756,8 @@ int parseZSharp(string script) } /*else LogWarning("unrecognized type \'" + words.at(lineNum).at(0) + "\' on line: " + to_string(lineNum));*/ - } -} + } + } return 0; } diff --git a/ZSharp/graphics.h b/ZSharp/graphics.h index 0ff0539..cc25ebd 100644 --- a/ZSharp/graphics.h +++ b/ZSharp/graphics.h @@ -392,10 +392,10 @@ public: { SDL_RenderCopy(gRenderer, texture, NULL, &rect); // Centers - rect.x = position.x - (rect.w / 2); - rect.y = position.y - (rect.h / 2); rect.w = scale.x; rect.h = scale.y; + rect.x = position.x - (rect.w / 2); + rect.y = position.y - (rect.h / 2); return 0; } @@ -504,6 +504,8 @@ public: scale.y /= AnyAsFloat(otherVal); } // Centers + rect.w = scale.x; + rect.h = scale.y; rect.x = position.x - (rect.w / 2); rect.y = position.y - (rect.h / 2); return *this; diff --git a/ZSharp/strops.cpp b/ZSharp/strops.cpp index cb53cfa..f3ae7ad 100644 --- a/ZSharp/strops.cpp +++ b/ZSharp/strops.cpp @@ -161,13 +161,13 @@ vector splitNoOverlap(const string& str, const char& splitBy, const char { if (i == (int)str.size() - 1) { - newStr.push_back(tmpStr+ str[i]); + newStr.push_back(trim(tmpStr + str[i])); break; } if (str[i] == splitBy && openCount == 0) { - newStr.push_back(tmpStr); + newStr.push_back(trim(tmpStr)); tmpStr = ""; continue; }