浏览代码

test

working test without scanstring changes
marauder2k7 1 年之前
父节点
当前提交
0d4c335231

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

@@ -245,16 +245,7 @@ public:
       if (type == ConsoleValueType::cvSTEntry)
          return s == StringTable->EmptyString() ? 0 : dAtoi(s);
       if (type == ConsoleValueType::cvString)
-      {
-         if (dStricmp(s, "false") == 0) {
-            return 0;
-         }
-         else if (dStricmp(s, "true") == 0) {
-            return 1;
-         }
-
-         return dIsdigit(*s) ? dAtoi(s) : s == StringTable->EmptyString() ? 0 : 1;
-      }
+         return dStrcmp(s, "") == 0 ? 0 : dAtoi(s);
 
       return dAtoi(getConsoleData());
    }

+ 2 - 2
Engine/source/console/torquescript/astNodes.cpp

@@ -211,10 +211,10 @@ U32 IfStmtNode::compileStmt(CodeStream& codeStream, U32 ip)
       integer = false;
    }
 
-   if (testType == TypeReqString)
+   if (testType == TypeReqString || testType == TypeReqNone)
    {
       ip = testExpr->compile(codeStream, ip, TypeReqString);
-      codeStream.emit(OP_JMPIFNOT);
+      codeStream.emit(OP_JMPSTRING);
    }
    else
    {

+ 8 - 0
Engine/source/console/torquescript/compiledEval.cpp

@@ -1163,6 +1163,14 @@ Con::EvalResult CodeBlock::exec(U32 ip, const char* functionName, Namespace* thi
          }
          ip = code[ip];
          break;
+      case OP_JMPSTRING:
+         if (stack[_STK--].getBool())
+         {
+            ip++;
+            break;
+         }
+         ip = code[ip];
+         break;
       case OP_JMPIFNOT_NP:
          if (stack[_STK].getInt())
          {

+ 1 - 0
Engine/source/console/torquescript/compiler.h

@@ -64,6 +64,7 @@ namespace Compiler
       OP_JMPIFNOT,
       OP_JMPIFF,
       OP_JMPIF,
+      OP_JMPSTRING,
       OP_JMPIFNOT_NP,
       OP_JMPIF_NP,    // 10
       OP_JMP,