diff options
| author | 2014-01-14 18:32:56 +0100 | |
|---|---|---|
| committer | 2014-01-14 18:32:56 +0100 | |
| commit | f654cc50e58814f5a1e5454470950f692030f842 (patch) | |
| tree | 322f0716402fbdb8934c4de35c9a69268d205773 | |
| parent | 435d8bfd12d00000bac5cc9675649bf13613dad4 (diff) | |
| download | OneRoll-f654cc50e58814f5a1e5454470950f692030f842.tar.gz OneRoll-f654cc50e58814f5a1e5454470950f692030f842.zip | |
Update dicerollernode.cpp
previous result API
| -rw-r--r-- | node/dicerollernode.cpp | 26 |
1 files 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); + } } } } |