aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/dicerollernode.cpp6
-rw-r--r--node/rerolldicenode.cpp20
-rw-r--r--node/rerolldicenode.h6
-rw-r--r--node/sortresult.cpp4
4 files changed, 23 insertions, 13 deletions
diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp
index c21b53c..f068f4b 100644
--- a/node/dicerollernode.cpp
+++ b/node/dicerollernode.cpp
@@ -1,4 +1,6 @@
#include "dicerollernode.h"
+#include "die.h"
+
#include <QDateTime>
#include <QDebug>
@@ -16,7 +18,9 @@ void DiceRollerNode::run(ExecutionNode* previous)
m_diceCount = previous->getResult()->getSum();
for(quint64 i=0; i < m_diceCount ; ++i)
{
- m_result.insertResult(rollDice());
+ Die die;
+ die.setValue(rollDice());
+ m_result.insertResult(die);
}
if(NULL!=m_nextNode)
{
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp
index 45f27de..6bc9467 100644
--- a/node/rerolldicenode.cpp
+++ b/node/rerolldicenode.cpp
@@ -1,21 +1,27 @@
#include "rerolldicenode.h"
+#include "dicerollernode.h"
-RerollDiceNode::RerollDiceNode(ExecutionNode* previous)
- : m_previous(previous)
+RerollDiceNode::RerollDiceNode()
{
}
-void RerollDiceNode::run()
+void RerollDiceNode::run(ExecutionNode* previous)
{
- if((NULL!=m_previous)&&(NULL!=m_previous->getResult()))
+ if((NULL!=previous)&&(NULL!=previous->getResult()))
{
- QList<qint64> list = m_previous->getResult()->getResultList();
+ QList<Die> list = previous->getResult()->getResultList();
- for(qint64 i=0; i < list.size() ; ++i)
+ foreach(Die die, list)
{
- // m_result.insertResult(rollDice());
+ if(m_value == die.getValue())
+ {
+/*
+ DiceRollerNode roller;
+ roller.run(this);*/
+ }
}
+
if(NULL!=m_nextNode)
{
m_nextNode->run(this);
diff --git a/node/rerolldicenode.h b/node/rerolldicenode.h
index 90dc81a..609fcf3 100644
--- a/node/rerolldicenode.h
+++ b/node/rerolldicenode.h
@@ -12,11 +12,11 @@ class RerollDiceNode : public ExecutionNode
public:
enum ReRollMode {EQUAL,LESSER,GREATER};
- RerollDiceNode(ExecutionNode* previous);
+ RerollDiceNode();
- virtual void run();
+ virtual void run(ExecutionNode* previous);
private:
- ExecutionNode* m_previous;
+ qint64 m_value;
};
#endif // REROLLDICENODE_H
diff --git a/node/sortresult.cpp b/node/sortresult.cpp
index f4364fa..f842fcc 100644
--- a/node/sortresult.cpp
+++ b/node/sortresult.cpp
@@ -12,8 +12,8 @@ void SortResultNode::run(ExecutionNode* node)
{
return;
}
- QList<qint64> diceList=node->getResult()->getResultList();
- QList<qint64> diceList2=m_result.getResultList();
+ QList<Die> diceList=node->getResult()->getResultList();
+ QList<Die> diceList2=m_result.getResultList();
diceList2 = diceList;
if(!m_ascending)