From 3cf50d44cdf19d52c94e3b5357adee4519dfdd49 Mon Sep 17 00:00:00 2001 From: obiwankennedy Date: Fri, 1 Jun 2018 15:49:06 +0200 Subject: fix issue about mergin reroll until and make the help command a bit more complete --- node/rerolldicenode.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'node/rerolldicenode.cpp') 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(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; } } } -- cgit v1.2.3-70-g09d2