From 187774c338c35864a2d3ad1c95ad06e9685c8427 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 22 Jan 2022 00:11:13 +0100 Subject: Fix valueslist with variable values. --- node/variablenode.cpp | 53 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'node/variablenode.cpp') 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(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(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(m_result); + if(nullptr == diceResult) + return; + + for(auto& die : diceResult->getResultList()) + { + die->setDisplayed(true); + } +} + QString VariableNode::toString(bool withLabel) const { if(withLabel) -- cgit v1.2.3-70-g09d2