diff options
| author | 2016-02-05 00:11:22 +0100 | |
|---|---|---|
| committer | 2016-02-05 00:11:22 +0100 | |
| commit | 8bd1dbafdec02dabcca9d19f44f21796f8729f8b (patch) | |
| tree | ca6f75ef62efc6706bd48793256a83e16632cf33 /node/paintnode.cpp | |
| parent | c671d21b54d43dbd6112f3ab50fc6ebd63dc4aef (diff) | |
| download | OneRoll-8bd1dbafdec02dabcca9d19f44f21796f8729f8b.tar.gz OneRoll-8bd1dbafdec02dabcca9d19f44f21796f8729f8b.zip | |
-Fix paintnode to integration into rolisteam.
Diffstat (limited to 'node/paintnode.cpp')
| -rw-r--r-- | node/paintnode.cpp | 23 |
1 files changed, 15 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 { |