aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/countexecutenode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2014-01-04 16:24:54 +0100
committerRenaud G <renaud@rolisteam.org>2014-01-04 16:24:54 +0100
commit4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6 (patch)
treed0553a394e50d1de1a5185a7006fe3cb66cbfa3b /node/countexecutenode.cpp
parent4114232457cbc5739872f479ef5d7772e6b5f42f (diff)
downloadOneRoll-4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6.tar.gz
OneRoll-4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6.zip
-Adding range, booleancondition and countexecutenode.
Diffstat (limited to 'node/countexecutenode.cpp')
-rw-r--r--node/countexecutenode.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/node/countexecutenode.cpp b/node/countexecutenode.cpp
new file mode 100644
index 0000000..fff00f2
--- /dev/null
+++ b/node/countexecutenode.cpp
@@ -0,0 +1,33 @@
+#include "countexecutenode.h"
+
+CountExecuteNode::CountExecuteNode()
+{
+}
+void CountExecuteNode::setValidator(Validator* validator)
+{
+ m_validator = validator;
+}
+
+void CountExecuteNode::run(ExecutionNode *previous)
+{
+ if(NULL==previous)
+ {
+ return;
+ }
+ QList<qint64> diceList=previous->getResult()->getResultList();
+ qint64 sum = 0;
+ foreach(qint64 dice,diceList)
+ {
+ if(m_validator->isValid(dice))
+ {
+ ++sum;
+ }
+ }
+ m_result.insertResult(sum);
+
+
+ if(NULL!=m_nextNode)
+ {
+ m_nextNode->run(this);
+ }
+}