From 02e09bccb6119cefe3a4ec8cee49a8baa9d2c7d5 Mon Sep 17 00:00:00 2001 From: Tomatix Date: Thu, 21 Oct 2021 16:25:12 +0200 Subject: [PATCH] #118 Fixed a bug in script engine with logical operators. --- Script/ValueHolder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Script/ValueHolder.cpp b/Script/ValueHolder.cpp index 3f50f93..5b7cdbc 100644 --- a/Script/ValueHolder.cpp +++ b/Script/ValueHolder.cpp @@ -527,7 +527,7 @@ bool ValueHolder::logicOperator(ParserOperator op, const ValueHolder& other) con ret = intOp(mv_i, std::get(*other.mval())); else if (otherType == Type::Real) ret = realOp(static_cast(mv_i), std::get(*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(*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(*other.mval())); else if (otherType == Type::Real) ret = stringOpL(mv_s, std::get(*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(*other.mval())); else if (otherType == Type::Void) ret = 0;