From f654cc50e58814f5a1e5454470950f692030f842 Mon Sep 17 00:00:00 2001 From: obiwankennedy Date: Tue, 14 Jan 2014 18:32:56 +0100 Subject: Update dicerollernode.cpp previous result API --- node/dicerollernode.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp index 3c16a34..b51277f 100644 --- a/node/dicerollernode.cpp +++ b/node/dicerollernode.cpp @@ -16,17 +16,23 @@ void DiceRollerNode::run(ExecutionNode* previous) { if(NULL!=previous) { - m_diceCount = previous->getResult()->getScalar(); - for(quint64 i=0; i < m_diceCount ; ++i) + Result* result=previous->getResult(); + if(NULL!=result) { - Die* die = new Die(); - die->setFaces(m_faces); - die->roll(); - m_myDiceResult->insertResult(die); - } - if(NULL!=m_nextNode) - { - m_nextNode->run(this); + m_diceCount = result->getScalar(); + m_result->setPrevious(result); + + for(quint64 i=0; i < m_diceCount ; ++i) + { + Die* die = new Die(); + die->setFaces(m_faces); + die->roll(); + m_myDiceResult->insertResult(die); + } + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } } } } -- cgit v1.2.3-70-g09d2