#118 Fixed a bug in script engine with logical operators.

master
Tomatix 3 years ago
parent 147d8b5905
commit 02e09bccb6
  1. 4
      Script/ValueHolder.cpp

@ -527,7 +527,7 @@ bool ValueHolder::logicOperator(ParserOperator op, const ValueHolder& other) con
ret = intOp(mv_i, std::get<int>(*other.mval()));
else if (otherType == Type::Real)
ret = realOp(static_cast<double>(mv_i), std::get<double>(*other.mval())); // TODO use some comparison with an epsilon value
if (otherType == Type::Bool)
else if (otherType == Type::Bool)
ret = boolOp(mv_i, std::get<bool>(*other.mval()));
else if (otherType == Type::Void)
ret = 0;
@ -594,7 +594,7 @@ bool ValueHolder::logicOperator(ParserOperator op, const ValueHolder& other) con
ret = stringOpL(mv_s, std::get<int>(*other.mval()));
else if (otherType == Type::Real)
ret = stringOpL(mv_s, std::get<double>(*other.mval()) != 0); // TODO use some comparison with an epsilon value
if (otherType == Type::Bool)
else if (otherType == Type::Bool)
ret = boolOp(!mv_s.empty(), std::get<bool>(*other.mval()));
else if (otherType == Type::Void)
ret = 0;

Loading…
Cancel
Save