From 63edd55e030475bd4abe1f39967cacf6e5adf892 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Fri, 19 Jul 2019 02:01:06 +0200 Subject: fix if behaviour and output --- node/ifnode.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'node') diff --git a/node/ifnode.cpp b/node/ifnode.cpp index fbcd9b9..5470e15 100644 --- a/node/ifnode.cpp +++ b/node/ifnode.cpp @@ -133,30 +133,30 @@ void IfNode::run(ExecutionNode* previous) } } } - } - - if(m_conditionType == OnScalar) - { - Die* dice= new Die(); - dice->setValue(value); - dice->insertRollValue(value); - dice->setMaxValue(value); - if(m_validator->hasValid(dice, true, true)) - { - nextNode= m_true; - } - else - { - nextNode= m_false; - } - if(nullptr != nextNode) + if(m_conditionType == OnScalar) { - if(nullptr == m_nextNode) + Die dice; + auto val= static_cast(value); + dice.setValue(val); + dice.insertRollValue(val); + dice.setMaxValue(val); + if(m_validator->hasValid(&dice, true, true)) { - m_nextNode= nextNode; + nextNode= m_true; + } + else + { + nextNode= m_false; + } + if(nullptr != nextNode) + { + if(nullptr == m_nextNode) + { + m_nextNode= nextNode; + } + nextNode->run(previousLoop); + previousLoop= getLeafNode(nextNode); } - nextNode->run(previousLoop); - previousLoop= getLeafNode(nextNode); } } } -- cgit v1.2.3-70-g09d2