diff options
| author | 2016-11-03 17:37:58 +0100 | |
|---|---|---|
| committer | 2016-11-03 17:37:58 +0100 | |
| commit | 3469ef7a412d82c2ea8c341ea58aa9b3d8aba22e (patch) | |
| tree | 8c8185f7dcfaabd492cee10643a0cb6398ac4ad3 | |
| parent | 9d389e561339e4fd7a68d60f593ad233e3941d13 (diff) | |
| download | OneRoll-3469ef7a412d82c2ea8c341ea58aa9b3d8aba22e.tar.gz OneRoll-3469ef7a412d82c2ea8c341ea58aa9b3d8aba22e.zip | |
-Add differentThan logical operator
| -rw-r--r-- | booleancondition.cpp | 8 | ||||
| -rw-r--r-- | booleancondition.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/booleancondition.cpp b/booleancondition.cpp index 83076e0..585620a 100644 --- a/booleancondition.cpp +++ b/booleancondition.cpp @@ -58,6 +58,9 @@ qint64 BooleanCondition::hasValid(Die* b,bool recursive,bool unhighlight) const case LesserOrEqual: sum+= (value<=m_value)?1:0; break; + case Different: + sum+= (value!=m_value)?1:0; + break; } } if((unhighlight)&&(sum==0)) @@ -101,6 +104,9 @@ QString BooleanCondition::toString() case LesserOrEqual: str.append(QStringLiteral("<=")); break; + case Different: + str.append(QStringLiteral("!=")); + break; } return QStringLiteral("[%1%2]").arg(str).arg(m_value); } @@ -118,5 +124,7 @@ quint64 BooleanCondition::getValidRangeSize(quint64 faces) const return faces-(m_value-1); case LesserOrEqual: return m_value; + case Different: + return faces-1; } } diff --git a/booleancondition.h b/booleancondition.h index 55a6b12..fa178b2 100644 --- a/booleancondition.h +++ b/booleancondition.h @@ -31,7 +31,7 @@ class BooleanCondition : public Validator { public: - enum LogicOperator { Equal, GreaterThan, LesserThan, GreaterOrEqual, LesserOrEqual}; + enum LogicOperator { Equal, GreaterThan, LesserThan, GreaterOrEqual, LesserOrEqual, Different}; BooleanCondition(); virtual qint64 hasValid(Die* b,bool recursive, bool unhighlight = false) const; |