aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/rerolldicenode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/rerolldicenode.cpp')
-rw-r--r--node/rerolldicenode.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp
index f51eb9e..a24ffa9 100644
--- a/node/rerolldicenode.cpp
+++ b/node/rerolldicenode.cpp
@@ -33,9 +33,11 @@ void RerollDiceNode::run(ExecutionNode* previous)
//m_diceResult->setResultList(list);
QList<Die*>& list = m_diceResult->getResultList();
+ QList<Die*> toRemove;
- for(Die* die: list)
+ for(int i = 0; i < list.size() ; ++i)
{
+ auto die = list.at(i);
if(m_validator->hasValid(die,false))
{
if(m_instruction != nullptr)
@@ -47,8 +49,10 @@ void RerollDiceNode::run(ExecutionNode* previous)
auto lastResult = dynamic_cast<DiceResult*>(lastNode->getResult());
if(lastResult != nullptr)
{
+ toRemove.append(die);
list.append(lastResult->getResultList());
}
+ lastResult->clear();
}
}
else
@@ -58,6 +62,12 @@ void RerollDiceNode::run(ExecutionNode* previous)
}
}
+ for(auto die: toRemove)
+ {
+ list.removeOne(die);
+ }
+
+
if(nullptr!=m_nextNode)
{
m_nextNode->run(this);