aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2014-01-05 13:12:05 +0100
committerRenaud G <renaud@rolisteam.org>2014-01-05 13:12:05 +0100
commit3853227d5852f45341c1ee49be4411ada78d860c (patch)
tree12bd626e68a445b37e0c3870a996aedf8552a5c8 /node
parent4de8cf5796446b7f8b09d776e4a6a6d6b8e95cb6 (diff)
downloadOneRoll-3853227d5852f45341c1ee49be4411ada78d860c.tar.gz
OneRoll-3853227d5852f45341c1ee49be4411ada78d860c.zip
Add new management of result.
It may require to make several
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)