diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 8ac3f2f4c..279f0dffc 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -245,7 +245,17 @@ public: if (type == ConsoleValueType::cvSTEntry) return s == StringTable->EmptyString() ? 0 : dAtoi(s); if (type == ConsoleValueType::cvString) - return dStrcmp(s, "") == 0 ? 0 : dIsdigit(*s) ? dAtoi(s) : s == StringTable->EmptyString() ? 0 : 1; + { + if (dStrcmp(s, "false") == 0) { + return 0; + } + else if (dStrcmp(s, "true") == 0) { + return 1; + } + + return dIsdigit(*s) ? dAtoi(s) : s == StringTable->EmptyString() ? 0 : 1; + } + return dAtoi(getConsoleData()); } diff --git a/Engine/source/console/torquescript/CMDscan.cpp b/Engine/source/console/torquescript/CMDscan.cpp index b533658f0..4497cb961 100644 --- a/Engine/source/console/torquescript/CMDscan.cpp +++ b/Engine/source/console/torquescript/CMDscan.cpp @@ -2827,18 +2827,6 @@ static int Sc_ScanString(int ret) if(!collapseEscape(CMDtext+1)) return -1; - const char* scannedStr = CMDtext + 1; - - if (dStrcmp(scannedStr, "true") == 0) { - CMDlval.i = MakeToken(1, yylineno); - return INTCONST; - } - - if (dStrcmp(scannedStr, "false") == 0) { - CMDlval.i = MakeToken(0, yylineno); - return INTCONST; - } - dsize_t bufferLen = dStrlen( CMDtext ); char* buffer = ( char* ) consoleAlloc( bufferLen ); dStrcpy( buffer, CMDtext + 1, bufferLen ); diff --git a/Engine/source/console/torquescript/CMDscan.l b/Engine/source/console/torquescript/CMDscan.l index 88246a3b5..aa3a72733 100644 --- a/Engine/source/console/torquescript/CMDscan.l +++ b/Engine/source/console/torquescript/CMDscan.l @@ -377,18 +377,6 @@ static int Sc_ScanString(int ret) if(!collapseEscape(CMDtext+1)) return -1; - const char* scannedStr = CMDtext + 1; - - if (dStrcmp(scannedStr, "true") == 0) { - CMDlval.i = MakeToken(1, yylineno); - return INTCONST; - } - - if (dStrcmp(scannedStr, "false") == 0) { - CMDlval.i = MakeToken(0, yylineno); - return INTCONST; - } - dsize_t bufferLen = dStrlen( CMDtext ); char* buffer = ( char* ) consoleAlloc( bufferLen ); dStrcpy( buffer, CMDtext + 1, bufferLen );