From 62d37d86caa5704fccc0d9c3a41d6e0d22e9603d Mon Sep 17 00:00:00 2001 From: obiwankennedy Date: Tue, 7 Jan 2014 18:52:28 +0100 Subject: Update keepdiceexecnode.cpp better API --- node/keepdiceexecnode.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'node') diff --git a/node/keepdiceexecnode.cpp b/node/keepdiceexecnode.cpp index cd2b76e..d700f8e 100644 --- a/node/keepdiceexecnode.cpp +++ b/node/keepdiceexecnode.cpp @@ -1,7 +1,13 @@ +#include + + #include "keepdiceexecnode.h" + KeepDiceExecNode::KeepDiceExecNode() + : m_diceResult(new DiceResult()) { + m_result = m_diceResult; } void KeepDiceExecNode::run(ExecutionNode* previous) @@ -10,15 +16,19 @@ void KeepDiceExecNode::run(ExecutionNode* previous) { return; } - QList diceList=previous->getResult()->getResultList(); - QList diceList2=m_result.getResultList(); + DiceResult* previousDiceResult = static_cast(previous->getResult()); + if(NULL!=previousDiceResult) + { + QList diceList=previousDiceResult->getResultList(); + QList diceList2=m_diceResult->getResultList(); - diceList2 = diceList.mid(0,m_numberOfDice); - m_result.setResultList(diceList2); - if(NULL!=m_nextNode) - { - m_nextNode->run(this); + diceList2 = diceList.mid(0,m_numberOfDice); + m_diceResult->setResultList(diceList2); + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } } } void KeepDiceExecNode::setDiceKeepNumber(quint64 n) -- cgit v1.2.3-70-g09d2