diff options
Diffstat (limited to 'node/jumpbackwardnode.cpp')
| -rw-r--r-- | node/jumpbackwardnode.cpp | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/node/jumpbackwardnode.cpp b/node/jumpbackwardnode.cpp index b0a5c8e..25056b1 100644 --- a/node/jumpbackwardnode.cpp +++ b/node/jumpbackwardnode.cpp @@ -70,31 +70,41 @@ void JumpBackwardNode::run(ExecutionNode* previous) } } - DiceResult* diceResult = dynamic_cast<DiceResult*>(result); - foreach(Die* die,diceResult->getResultList()) + if(NULL==result) { - Die* tmpdie = new Die(); - *tmpdie=*die; - m_diceResult->insertResult(tmpdie); - die->displayed(); + m_errors.insert(DIE_RESULT_EXPECTED,QObject::tr(" The @ operator expects dice result. Please check the documentation to fix your command.")); } + else + { + DiceResult* diceResult = dynamic_cast<DiceResult*>(result); + if(NULL!=diceResult) + { + foreach(Die* die,diceResult->getResultList()) + { + Die* tmpdie = new Die(); + *tmpdie=*die; + m_diceResult->insertResult(tmpdie); + die->displayed(); + } + } + m_result->setPrevious(parent->getResult()); - m_result->setPrevious(parent->getResult()); - - - - if(NULL!=m_nextNode) - { - m_nextNode->run(this); - } - for(int i =0;i<diceResult->getResultList().size();++i) - { - Die* tmp =diceResult->getResultList().at(i); - Die* tmp2 =m_diceResult->getResultList().at(i); - if(tmp->isHighlighted()) + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } + if(NULL!=diceResult) { - tmp2->setHighlighted(true); + for(int i =0;i<diceResult->getResultList().size();++i) + { + Die* tmp =diceResult->getResultList().at(i); + Die* tmp2 =m_diceResult->getResultList().at(i); + if(tmp->isHighlighted()) + { + tmp2->setHighlighted(true); + } + } } } |