mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-25 22:35:37 +00:00
move parameters instead of copying.
This commit is contained in:
parent
964fde8f09
commit
dcd01e1231
2 changed files with 6 additions and 17 deletions
|
|
@ -490,23 +490,7 @@ ConsoleValue CodeBlock::exec(U32 ip, const char* functionName, Namespace* thisNa
|
||||||
{
|
{
|
||||||
S32 reg = code[ip + (2 + 6 + 1 + 1) + i];
|
S32 reg = code[ip + (2 + 6 + 1 + 1) + i];
|
||||||
ConsoleValue& value = argv[i + 1];
|
ConsoleValue& value = argv[i + 1];
|
||||||
switch (value.getType())
|
gEvalState.moveConsoleValue(reg, std::move(value));
|
||||||
{
|
|
||||||
case ConsoleValueType::cvString:
|
|
||||||
gEvalState.setLocalStringVariable(reg, value.getString(), dStrlen(value.getString()));
|
|
||||||
break;
|
|
||||||
case ConsoleValueType::cvInteger:
|
|
||||||
gEvalState.setLocalIntVariable(reg, value.getInt());
|
|
||||||
break;
|
|
||||||
case ConsoleValueType::cvFloat:
|
|
||||||
gEvalState.setLocalFloatVariable(reg, value.getFloat());
|
|
||||||
break;
|
|
||||||
case ConsoleValueType::cvSTEntry:
|
|
||||||
gEvalState.setLocalStringTableEntryVariable(reg, value.getString());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
AssertFatal(false, avar("Invalid local variable type. Type was: %i", value.getType()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ip = ip + fnArgc + (2 + 6 + 1 + 1);
|
ip = ip + fnArgc + (2 + 6 + 1 + 1);
|
||||||
curFloatTable = functionFloats;
|
curFloatTable = functionFloats;
|
||||||
|
|
|
||||||
|
|
@ -622,6 +622,11 @@ public:
|
||||||
currentRegisterArray->values[reg].setStringTableEntry(val);
|
currentRegisterArray->values[reg].setStringTableEntry(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue val)
|
||||||
|
{
|
||||||
|
currentRegisterArray->values[reg] = std::move(val);
|
||||||
|
}
|
||||||
|
|
||||||
void pushFrame(StringTableEntry frameName, Namespace *ns, S32 regCount);
|
void pushFrame(StringTableEntry frameName, Namespace *ns, S32 regCount);
|
||||||
void popFrame();
|
void popFrame();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue