diff options
| author | 2022-01-22 00:11:13 +0100 | |
|---|---|---|
| committer | 2022-01-22 00:19:30 +0100 | |
| commit | 187774c338c35864a2d3ad1c95ad06e9685c8427 (patch) | |
| tree | a7a7a23b00afd3c7ad489d4f5610ee305e7217be /node/variablenode.cpp | |
| parent | 82eb7c25f863c930d3138cdcbc95fb797cc77600 (diff) | |
| download | OneRoll-187774c338c35864a2d3ad1c95ad06e9685c8427.tar.gz OneRoll-187774c338c35864a2d3ad1c95ad06e9685c8427.zip | |
Fix valueslist with variable values.
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) |