aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2016-02-05 00:11:22 +0100
committerRenaud G <renaud@rolisteam.org>2016-02-05 00:11:22 +0100
commit8bd1dbafdec02dabcca9d19f44f21796f8729f8b (patch)
treeca6f75ef62efc6706bd48793256a83e16632cf33 /node
parentc671d21b54d43dbd6112f3ab50fc6ebd63dc4aef (diff)
downloadOneRoll-8bd1dbafdec02dabcca9d19f44f21796f8729f8b.tar.gz
OneRoll-8bd1dbafdec02dabcca9d19f44f21796f8729f8b.zip
-Fix paintnode to integration into rolisteam.
Diffstat (limited to 'node')
-rw-r--r--node/paintnode.cpp23
-rw-r--r--node/paintnode.h1
2 files changed, 16 insertions, 8 deletions
diff --git a/node/paintnode.cpp b/node/paintnode.cpp
index 19eeb7f..ad13c52 100644
--- a/node/paintnode.cpp
+++ b/node/paintnode.cpp
@@ -51,18 +51,20 @@ void ColorItem::setColor(const QString &color)
///////////////////////////////////
PainterNode::PainterNode()
+ : ExecutionNode()
{
-
+ m_result = NULL;
+ m_nextNode = NULL;
}
PainterNode::~PainterNode()
{
-
+ m_result = NULL;
}
-void PainterNode::run(ExecutionNode *previous)
+void PainterNode::run(ExecutionNode* previous)
{
m_previousNode = previous;
if(NULL==previous)
@@ -70,28 +72,33 @@ void PainterNode::run(ExecutionNode *previous)
return;
}
Result* previousResult = previous->getResult();
- m_result = previousResult;
+ //m_result = previousResult;
DiceResult* previousDiceResult = dynamic_cast<DiceResult*>(previousResult);
if(NULL!=previousDiceResult)
{
- QList<Die*> diceList=previousDiceResult->getResultList();
+ QList<Die*> diceList=previousDiceResult->getResultList();
+ int pastDice=0;
foreach(ColorItem item, m_colors)
{
int current=item.colorNumber();
QList<Die*>::iterator it;
- for(it = diceList.begin(); it != diceList.end() && current>0 ; ++it)
+ for(it = diceList.begin()+pastDice; it != diceList.end() && current>0 ; ++it)
{
(*it)->setColor(item.color());
--current;
+ ++pastDice;
}
}
}
if(NULL!=m_nextNode)
{
- m_nextNode->run(this);
+ m_nextNode->run(previous);
}
}
-
+Result* PainterNode::getResult()
+{
+ m_previousNode->getResult();
+}
QString PainterNode::toString(bool wl) const
{
diff --git a/node/paintnode.h b/node/paintnode.h
index e01eaee..52a9ddb 100644
--- a/node/paintnode.h
+++ b/node/paintnode.h
@@ -47,6 +47,7 @@ public:
PainterNode();
virtual ~PainterNode();
virtual void run(ExecutionNode* previous = NULL);
+ Result* getResult();
virtual QString toString(bool )const;
virtual qint64 getPriority() const;
void insertColorItem(QString color, int value);