本文整理汇总了C++中ScValue::getBool方法的典型用法代码示例。如果您正苦于以下问题:C++ ScValue::getBool方法的具体用法?C++ ScValue::getBool怎么用?C++ ScValue::getBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScValue
的用法示例。
在下文中一共展示了ScValue::getBool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeInstruction
//.........这里部分代码省略.........
str = _stack->pop()->getString();
ScValue *var = _stack->pop();
ScValue *val = _stack->pop();
if (val == nullptr) {
runtimeError("Script stack corruption detected. Please report this script at WME bug reports forum.");
var->setNULL();
} else {
var->setProp(str, val);
}
break;
}
case II_PUSH_REG1:
_stack->push(_reg1);
break;
case II_POP_REG1:
_reg1->copy(_stack->pop());
break;
case II_JMP:
_iP = getDWORD();
break;
case II_JMP_FALSE: {
dw = getDWORD();
//if (!_stack->pop()->getBool()) _iP = dw;
ScValue *val = _stack->pop();
if (!val) {
runtimeError("Script corruption detected. Did you use '=' instead of '==' for comparison?");
} else {
if (!val->getBool()) {
_iP = dw;
}
}
break;
}
case II_ADD:
op2 = _stack->pop();
op1 = _stack->pop();
if (op1->isNULL() || op2->isNULL()) {
_operand->setNULL();
} else if (op1->getType() == VAL_STRING || op2->getType() == VAL_STRING) {
char *tempStr = new char [strlen(op1->getString()) + strlen(op2->getString()) + 1];
strcpy(tempStr, op1->getString());
strcat(tempStr, op2->getString());
_operand->setString(tempStr);
delete[] tempStr;
} else if (op1->getType() == VAL_INT && op2->getType() == VAL_INT) {
_operand->setInt(op1->getInt() + op2->getInt());
} else {
_operand->setFloat(op1->getFloat() + op2->getFloat());
}
_stack->push(_operand);
break;
case II_SUB:
op2 = _stack->pop();
op1 = _stack->pop();