aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/ifnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-07-19 02:01:06 +0200
committerRenaud G <renaud@rolisteam.org>2019-07-19 02:01:06 +0200
commit63edd55e030475bd4abe1f39967cacf6e5adf892 (patch)
tree3857f7e75b5dc60c0b9b6e26504584a893468ce2 /node/ifnode.cpp
parent504d91db102a840e461b8b2ba442c0f76d581742 (diff)
downloadOneRoll-63edd55e030475bd4abe1f39967cacf6e5adf892.tar.gz
OneRoll-63edd55e030475bd4abe1f39967cacf6e5adf892.zip
fix if behaviour and output
Diffstat (limited to 'node/ifnode.cpp')
-rw-r--r--node/ifnode.cpp42
1 files changed, 21 insertions, 21 deletions
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<qint64>(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);
}
}
}