2
0
marauder2k7 8 сар өмнө
parent
commit
ee0cf872a0

+ 96 - 5
Engine/source/console/console.h

@@ -203,17 +203,108 @@ public:
 
    ConsoleValue(ConsoleValue&& ref) noexcept
    {
-      _move(std::move(ref));
+      type = ref.type;
+
+      switch (ref.type)
+      {
+      case cvInteger:
+         i = ref.i;
+         break;
+      case cvFloat:
+         f = ref.f;
+         break;
+      case cvSTEntry:
+         TORQUE_CASE_FALLTHROUGH;
+      case cvString:
+         s = ref.s;
+         ref.s = const_cast<char*>(StringTable->EmptyString());
+         break;
+      default:
+         data = ref.data;
+
+         break;
+      }
+      ref.type = ConsoleValueType::cvSTEntry;
+      ref.data = NULL;
    }
 
    TORQUE_FORCEINLINE ConsoleValue& operator=(ConsoleValue&& ref) noexcept
    {
-      _move(std::move(ref));
+      type = ref.type;
+
+      switch (ref.type)
+      {
+      case cvInteger:
+         i = ref.i;
+         break;
+      case cvFloat:
+         f = ref.f;
+         break;
+      case cvSTEntry:
+         TORQUE_CASE_FALLTHROUGH;
+      case cvString:
+         s = ref.s;
+         ref.s = const_cast<char*>(StringTable->EmptyString());
+         break;
+      default:
+         data = ref.data;
+
+         break;
+      }
+      ref.type = ConsoleValueType::cvSTEntry;
+      ref.data = NULL;
       return *this;
    }
 
-   ConsoleValue(const ConsoleValue&) = delete;
-   ConsoleValue& operator=(const ConsoleValue&) = delete;
+   ConsoleValue(const ConsoleValue& ref)
+   {
+      type = ref.type;
+
+      switch (ref.type)
+      {
+      case cvInteger:
+         i = ref.i;
+         break;
+      case cvFloat:
+         f = ref.f;
+         break;
+      case cvSTEntry:
+         TORQUE_CASE_FALLTHROUGH;
+      case cvString:
+         s = ref.s;
+         break;
+      default:
+         data = ref.data;
+
+         break;
+      }
+   }
+
+   ConsoleValue& operator=(const ConsoleValue& ref)
+   {
+      type = ref.type;
+
+      switch (ref.type)
+      {
+      case cvInteger:
+         i = ref.i;
+         break;
+      case cvFloat:
+         f = ref.f;
+         break;
+      case cvSTEntry:
+         TORQUE_CASE_FALLTHROUGH;
+      case cvString:
+         s = ref.s;
+         break;
+      default:
+         data = ref.data;
+
+         break;
+      }
+
+      return *this;
+   }
 
    TORQUE_FORCEINLINE ~ConsoleValue()
    {
@@ -1022,7 +1113,7 @@ namespace Con
    ConsoleValue executef(R r, ArgTs ...argTs)
    {
       _EngineConsoleExecCallbackHelper<R> callback(r);
-      return std::move(callback.template call<ConsoleValue>(argTs...));
+      return (callback.template call<ConsoleValue>(argTs...));
    }
    /// }
 };

+ 2 - 2
Engine/source/console/consoleInternal.cpp

@@ -1159,7 +1159,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject *
    {
       if (mFunctionOffset)
       {
-         return std::move(mModule->exec(mFunctionOffset, argv[0].getString(), mNamespace, argc, argv, false, mPackage).value);
+         return (mModule->exec(mFunctionOffset, argv[0].getString(), mNamespace, argc, argv, false, mPackage).value);
       }
       else
       {
@@ -1173,7 +1173,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject *
    if (mToolOnly && !Con::isCurrentScriptToolScript())
    {
       Con::errorf(ConsoleLogEntry::Script, "%s::%s - attempting to call tools only function from outside of tools", mNamespace->mName, mFunctionName);
-      return std::move(ConsoleValue());
+      return (ConsoleValue());
    }
 #endif
 

+ 1 - 1
Engine/source/console/consoleInternal.h

@@ -321,7 +321,7 @@ public:
 
       void reset();
 
-      inline ConsoleValue getValue() { return std::move(value); }
+      inline ConsoleValue getValue() { return (value); }
 
       inline U32 getIntValue()
       {

+ 6 - 0
Engine/source/console/consoleObject.cpp

@@ -286,6 +286,12 @@ void AbstractClassRep::shutdown()
 
    // Release storage allocated to the class table.
 
+   for (auto walk = classLinkList; walk; walk = walk->nextClass)
+   {
+      walk->mFieldList.clear();
+      walk->mFieldList.compact(); // Important: frees the internal buffer
+   }
+
    for (U32 group = 0; group < NetClassGroupsCount; group++)
       for(U32 type = 0; type < NetClassTypesCount; type++)
          if( classTable[ group ][ type ] )

+ 1 - 1
Engine/source/console/simEvents.cpp

@@ -116,7 +116,7 @@ ConsoleValue SimConsoleThreadExecCallback::waitForResult()
 {
    if(sem->acquire(true))
    {
-      return std::move(retVal);
+      return (retVal);
    }
 
    return ConsoleValue();

+ 2 - 2
Engine/source/console/torquescript/evalState.h

@@ -1,4 +1,4 @@
-#ifndef _EVALSTATE_H
+#ifndef _EVALSTATE_H
 #define _EVALSTATE_H
 #include "console/consoleInternal.h"
 
@@ -81,7 +81,7 @@ public:
       currentRegisterArray->values[reg].setStringTableEntry(val);
    }
 
-   TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue val)
+   TORQUE_FORCEINLINE void moveConsoleValue(S32 reg, ConsoleValue&& val)
    {
       currentRegisterArray->values[reg] = std::move(val);
    }