aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/ifnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2017-02-28 18:58:12 +0100
committerRenaud G <renaud@rolisteam.org>2017-02-28 18:58:12 +0100
commit49e3f9a3a7acba5db5ea415e4487c3d200d26454 (patch)
treea8d0d39c3c5a15967795e2b2597ebf44fcd009f9 /node/ifnode.cpp
parent527011e141ea8022a2bb41a52ef64fbb6cac0cfe (diff)
downloadOneRoll-49e3f9a3a7acba5db5ea415e4487c3d200d26454.tar.gz
OneRoll-49e3f9a3a7acba5db5ea415e4487c3d200d26454.zip
-Add : compare operator to ask the if operator to compare the scalar
result.
Diffstat (limited to 'node/ifnode.cpp')
-rw-r--r--node/ifnode.cpp40
1 files changed, 21 insertions, 19 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);
}
}
}