if statements

Changed:
if check on vals now return true if the value has a string value
%val = "test me" if(%val) will now return true since %val is not null

Script side:
string checks for "true" and "false" will now be parsed as integer values of 1 and 0.

TEST VIGOUROUSLY
This commit is contained in:
marauder2k7 2024-06-16 15:04:20 +01:00
parent 760c153232
commit e56f4cb6a6
5 changed files with 39 additions and 4 deletions

View file

@ -2827,6 +2827,18 @@ 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<int>(1, yylineno);
return INTCONST;
}
if (dStrcmp(scannedStr, "false") == 0) {
CMDlval.i = MakeToken<int>(0, yylineno);
return INTCONST;
}
dsize_t bufferLen = dStrlen( CMDtext );
char* buffer = ( char* ) consoleAlloc( bufferLen );
dStrcpy( buffer, CMDtext + 1, bufferLen );