aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/dicerollernode.cpp
diff options
context:
space:
mode:
authorobiwankennedy <renaud@rolisteam.org>2014-01-14 18:32:56 +0100
committerobiwankennedy <renaud@rolisteam.org>2014-01-14 18:32:56 +0100
commitf654cc50e58814f5a1e5454470950f692030f842 (patch)
tree322f0716402fbdb8934c4de35c9a69268d205773 /node/dicerollernode.cpp
parent435d8bfd12d00000bac5cc9675649bf13613dad4 (diff)
downloadOneRoll-f654cc50e58814f5a1e5454470950f692030f842.tar.gz
OneRoll-f654cc50e58814f5a1e5454470950f692030f842.zip
Update dicerollernode.cpp
previous result API
Diffstat (limited to 'node/dicerollernode.cpp')
-rw-r--r--node/dicerollernode.cpp26
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);
+ }
}
}
}