diff options
| author | 2017-03-10 01:15:30 +0100 | |
|---|---|---|
| committer | 2017-03-10 01:15:30 +0100 | |
| commit | 026ca5cb4829cd4c4ad6b945e27479303e96fe82 (patch) | |
| tree | 6b9f4972ca71d9cfcd2ae26789103e501aa4e3c4 /node | |
| parent | 993a636818d237feaca1870a65b72ab1d4ead31d (diff) | |
| parent | 6fdd7dad0a24cff8bd20907425a7b9f91e33fdd8 (diff) | |
| download | OneRoll-026ca5cb4829cd4c4ad6b945e27479303e96fe82.tar.gz OneRoll-026ca5cb4829cd4c4ad6b945e27479303e96fe82.zip | |
Merge branch 'master' of github.com:Rolisteam/DiceParser
Diffstat (limited to 'node')
| -rw-r--r-- | node/ifnode.cpp | 40 | ||||
| -rw-r--r-- | node/ifnode.h | 2 |
2 files changed, 22 insertions, 20 deletions
diff --git a/node/ifnode.cpp b/node/ifnode.cpp index 27b588f..91ad199 100644 --- a/node/ifnode.cpp +++ b/node/ifnode.cpp @@ -81,7 +81,7 @@ void IfNode::run(ExecutionNode *previous) } } } - else + else if((m_conditionType == OneOfThem)||(m_conditionType == AllOfThem)) { bool trueForAll=true; bool falseForAll=true; @@ -133,28 +133,30 @@ void IfNode::run(ExecutionNode *previous) } } } + } + + if(m_conditionType == OnScalar) + { + Die* dice = new Die(); + dice->setValue(value); + dice->insertRollValue(value); + dice->setMaxValue(value); + if(m_validator->hasValid(dice,true,true)) + { + nextNode=m_true; + } else { - Die* dice = new Die(); - dice->setValue(value); - dice->setMaxValue(value); - if(m_validator->hasValid(dice,true,true)) - { - nextNode=m_true; - } - else - { - nextNode=m_false; - } - if(NULL!=nextNode) + nextNode=m_false; + } + if(NULL!=nextNode) + { + if(NULL==m_nextNode) { - if(NULL==m_nextNode) - { - m_nextNode = nextNode; - } - nextNode->run(previousLoop); - previousLoop = getLeafNode(nextNode); + m_nextNode = nextNode; } + nextNode->run(previousLoop); + previousLoop = getLeafNode(nextNode); } } } diff --git a/node/ifnode.h b/node/ifnode.h index da8bb0b..7376101 100644 --- a/node/ifnode.h +++ b/node/ifnode.h @@ -34,7 +34,7 @@ public: /** * @brief The ConditionType enum */ - enum ConditionType {OnEach,OneOfThem,AllOfThem}; + enum ConditionType {OnEach,OneOfThem,AllOfThem,OnScalar}; /** * @brief IfNode */ |