diff options
Diffstat (limited to 'node/variablenode.cpp')
| -rw-r--r-- | node/variablenode.cpp | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/node/variablenode.cpp b/node/variablenode.cpp index f48c254..416be86 100644 --- a/node/variablenode.cpp +++ b/node/variablenode.cpp @@ -9,26 +9,27 @@ void VariableNode::run(ExecutionNode* previous) { auto value= (*m_data)[m_index]; value= ParsingToolBox::getLeafNode(value); - if(nullptr != value) + if(nullptr == value) + return; + + auto result= value->getResult(); + if(!result) + return; + + auto copy= result->getCopy(); + auto diceResult= dynamic_cast<DiceResult*>(result); + if(nullptr == diceResult) + return; + + for(auto& die : diceResult->getResultList()) + { + die->setDisplayed(false); + } + + m_result= copy; + if(nullptr != m_nextNode) { - auto result= value->getResult(); - if(result) - { - auto copy= result->getCopy(); - auto diceResult= dynamic_cast<DiceResult*>(result); - if(nullptr != diceResult) - { - for(auto& die : diceResult->getResultList()) - { - die->setDisplayed(false); - } - } - m_result= copy; - if(nullptr != m_nextNode) - { - m_nextNode->run(this); - } - } + m_nextNode->run(this); } } else @@ -37,6 +38,20 @@ void VariableNode::run(ExecutionNode* previous) } } +void VariableNode::setDisplayed() +{ + if(!m_result) + return; + auto diceResult= dynamic_cast<DiceResult*>(m_result); + if(nullptr == diceResult) + return; + + for(auto& die : diceResult->getResultList()) + { + die->setDisplayed(true); + } +} + QString VariableNode::toString(bool withLabel) const { if(withLabel) |