From 8bd1dbafdec02dabcca9d19f44f21796f8729f8b Mon Sep 17 00:00:00 2001 From: Renaud G Date: Fri, 5 Feb 2016 00:11:22 +0100 Subject: -Fix paintnode to integration into rolisteam. --- node/paintnode.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'node/paintnode.cpp') 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(previousResult); if(NULL!=previousDiceResult) { - QList diceList=previousDiceResult->getResultList(); + QList diceList=previousDiceResult->getResultList(); + int pastDice=0; foreach(ColorItem item, m_colors) { int current=item.colorNumber(); QList::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 { -- cgit v1.2.3-70-g09d2