mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
Small fixes for the script interpreter.
This commit is contained in:
parent
69d7a2f4a1
commit
8fc0db21c1
3 changed files with 11 additions and 11 deletions
|
|
@ -518,17 +518,17 @@ TORQUE_NOINLINE void doSlowMathOp()
|
||||||
|
|
||||||
// Logical
|
// Logical
|
||||||
if constexpr (Op == FloatOperation::LT)
|
if constexpr (Op == FloatOperation::LT)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() < b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() < b.getFloat());
|
||||||
if constexpr (Op == FloatOperation::LE)
|
if constexpr (Op == FloatOperation::LE)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() <= b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() <= b.getFloat());
|
||||||
if constexpr (Op == FloatOperation::GR)
|
if constexpr (Op == FloatOperation::GR)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() > b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() > b.getFloat());
|
||||||
if constexpr (Op == FloatOperation::GE)
|
if constexpr (Op == FloatOperation::GE)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() >= b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() >= b.getFloat());
|
||||||
if constexpr (Op == FloatOperation::EQ)
|
if constexpr (Op == FloatOperation::EQ)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() == b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() == b.getFloat());
|
||||||
if constexpr (Op == FloatOperation::NE)
|
if constexpr (Op == FloatOperation::NE)
|
||||||
stack[_STK - 1].setFastInt(a.getFloat() != b.getFloat());
|
stack[_STK - 1].setInt(a.getFloat() != b.getFloat());
|
||||||
|
|
||||||
_STK--;
|
_STK--;
|
||||||
}
|
}
|
||||||
|
|
@ -1276,7 +1276,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
||||||
_STK++; // Not nice but works.
|
_STK++; // Not nice but works.
|
||||||
}
|
}
|
||||||
|
|
||||||
returnValue.setString(stack[_STK].getString());
|
returnValue = std::move(stack[_STK]);
|
||||||
_STK--;
|
_STK--;
|
||||||
|
|
||||||
goto execFinished;
|
goto execFinished;
|
||||||
|
|
|
||||||
|
|
@ -389,14 +389,14 @@ SimObject* findObject(const char* name)
|
||||||
SimObject* findObject(const ConsoleValue &val)
|
SimObject* findObject(const ConsoleValue &val)
|
||||||
{
|
{
|
||||||
if (val.getType() == ConsoleValueType::cvInteger)
|
if (val.getType() == ConsoleValueType::cvInteger)
|
||||||
return findObject((SimObjectId)val.getInt());
|
return findObject((SimObjectId)val.getFastInt());
|
||||||
return findObject(val.getString());
|
return findObject(val.getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
SimObject* findObject(ConsoleValue* val)
|
SimObject* findObject(ConsoleValue* val)
|
||||||
{
|
{
|
||||||
if (val->getType() == ConsoleValueType::cvInteger)
|
if (val->getType() == ConsoleValueType::cvInteger)
|
||||||
return findObject((SimObjectId)val->getInt());
|
return findObject((SimObjectId)val->getFastInt());
|
||||||
return findObject(val->getString());
|
return findObject(val->getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -410,14 +410,14 @@ TEST(Script, ForEachLoop)
|
||||||
TEST(Script, TorqueScript_Array_Testing)
|
TEST(Script, TorqueScript_Array_Testing)
|
||||||
{
|
{
|
||||||
ConsoleValue value = RunScript(R"(
|
ConsoleValue value = RunScript(R"(
|
||||||
function t(%idx) { %a[idx] = 2; return %a[idx]; }
|
function t(%idx) { %a[%idx] = 2; return %a[%idx]; }
|
||||||
return t(5);
|
return t(5);
|
||||||
)");
|
)");
|
||||||
|
|
||||||
ASSERT_EQ(value.getInt(), 2);
|
ASSERT_EQ(value.getInt(), 2);
|
||||||
|
|
||||||
ConsoleValue value2 = RunScript(R"(
|
ConsoleValue value2 = RunScript(R"(
|
||||||
function t(%idx) { %a[idx, 0] = 2; return %a[idx, 0]; }
|
function t(%idx) { %a[%idx, 0] = 2; return %a[%idx, 0]; }
|
||||||
return t(5);
|
return t(5);
|
||||||
)");
|
)");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue