aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/rerolldicenode.cpp
diff options
context:
space:
mode:
authorobiwankennedy <renaud@rolisteam.org>2018-06-01 15:49:06 +0200
committerobiwankennedy <renaud@rolisteam.org>2018-06-01 15:49:06 +0200
commit3cf50d44cdf19d52c94e3b5357adee4519dfdd49 (patch)
tree0a73d7a2132a9909fe5a270d6feb1689ed360019 /node/rerolldicenode.cpp
parent0a9202c3ef0d3255ae3d57d0df68f7232396b580 (diff)
downloadOneRoll-3cf50d44cdf19d52c94e3b5357adee4519dfdd49.tar.gz
OneRoll-3cf50d44cdf19d52c94e3b5357adee4519dfdd49.zip
fix issue about mergin reroll until and make the help command a bit more complete
Diffstat (limited to 'node/rerolldicenode.cpp')
-rw-r--r--node/rerolldicenode.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp
index f7df0fa..21e0dbf 100644
--- a/node/rerolldicenode.cpp
+++ b/node/rerolldicenode.cpp
@@ -41,12 +41,32 @@ void RerollDiceNode::run(ExecutionNode* previous)
for(int i = 0; i < list.size() ; ++i)
{
auto die = list.at(i);
- while(m_validator->hasValid(die,false))
+ bool finished = false;
+ while(m_validator->hasValid(die,false) && !finished)
{
- die->roll(m_adding);
+ qDebug() << "reroll"<< die->getValue() << m_instruction;
+ if(m_instruction != nullptr)
+ {
+ m_instruction->run(this);
+ auto lastNode = ParsingToolBox::getLatestNode(m_instruction);
+ if(lastNode != nullptr)
+ {
+ auto lastResult = dynamic_cast<DiceResult*>(lastNode->getResult());
+ if(lastResult != nullptr)
+ {
+ toRemove.append(die);
+ list.append(lastResult->getResultList());
+ }
+ lastResult->clear();
+ }
+ }
+ else
+ {
+ die->roll(m_adding);
+ }
if(m_reroll)
{
- break;
+ finished = true;
}
}
}