aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/explodedicenode.cpp
diff options
context:
space:
mode:
authorrenaud guezennec <renaud@rolisteam.org>2019-07-29 20:35:52 +0000
committerrenaud guezennec <renaud@rolisteam.org>2019-07-29 20:35:52 +0000
commit1a902d383eef1e042d4462cd07b9384fcdf4d118 (patch)
tree766b8ab720fa5da11730d2fc2388f51b9d14de49 /node/explodedicenode.cpp
parentf5906125576a8323a731c9456ce3dfc53b67ef59 (diff)
parent0d4b68221bda594cc695d216dfa21306ddb69c85 (diff)
downloadOneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.tar.gz
OneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.zip
Merge branch 'liberation' into 'master'
Add fuzzer on the DiceParser See merge request kde/rolisteam-diceparser!2
Diffstat (limited to 'node/explodedicenode.cpp')
-rw-r--r--node/explodedicenode.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/node/explodedicenode.cpp b/node/explodedicenode.cpp
index 704ac8a..2292a05 100644
--- a/node/explodedicenode.cpp
+++ b/node/explodedicenode.cpp
@@ -16,7 +16,6 @@ void ExplodeDiceNode::run(ExecutionNode* previous)
for(auto& die : previous_result->getResultList())
{
Die* tmpdie= new Die(*die);
-// *tmpdie= *die;
m_diceResult->insertResult(tmpdie);
die->displayed();
}
@@ -25,12 +24,23 @@ void ExplodeDiceNode::run(ExecutionNode* previous)
for(auto& die : list)
{
+ if(Dice::CONDITION_STATE::ALWAYSTRUE
+ == m_validator->isValidRangeSize(std::make_pair<qint64, qint64>(die->getBase(), die->getMaxValue())))
+ {
+ m_errors.insert(Dice::ERROR_CODE::ENDLESS_LOOP_ERROR,
+ QObject::tr("Condition (%1) cause an endless loop with this dice: %2")
+ .arg(toString(true))
+ .arg(QStringLiteral("d[%1,%2]")
+ .arg(static_cast<int>(die->getBase()))
+ .arg(static_cast<int>(die->getMaxValue()))));
+ continue;
+ }
+
while(m_validator->hasValid(die, false))
{
die->roll(true);
}
}
- // m_diceResult->setResultList(list);
if(nullptr != m_nextNode)
{