aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/keepdiceexecnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2016-11-28 00:36:15 +0100
committerRenaud G <renaud@rolisteam.org>2016-11-28 00:36:15 +0100
commit13e297604b00615d47352538e3c82ea1ac700d4c (patch)
tree567efe03594d261831897f03a7821c4c6eeac59b /node/keepdiceexecnode.cpp
parentcdd1716bd1aa8d9bbd0137aa98ff24867b6b3a0e (diff)
downloadOneRoll-13e297604b00615d47352538e3c82ea1ac700d4c.tar.gz
OneRoll-13e297604b00615d47352538e3c82ea1ac700d4c.zip
-Add API for copying a branch of execution node.
-Allow to use if node several times.
Diffstat (limited to 'node/keepdiceexecnode.cpp')
-rw-r--r--node/keepdiceexecnode.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/node/keepdiceexecnode.cpp b/node/keepdiceexecnode.cpp
index 40a3fce..ab961af 100644
--- a/node/keepdiceexecnode.cpp
+++ b/node/keepdiceexecnode.cpp
@@ -48,7 +48,7 @@ void KeepDiceExecNode::run(ExecutionNode* previous)
m_errors.insert(TOO_MANY_DICE,QObject::tr(" You ask to keep %1 dice but the result only has %2").arg(m_numberOfDice).arg(diceList.size()));
}
- foreach(Die* tmp,diceList.mid(m_numberOfDice,-1))
+ for(Die* tmp : diceList.mid(m_numberOfDice,-1))
{
tmp->setHighlighted(false);
}
@@ -86,3 +86,15 @@ qint64 KeepDiceExecNode::getPriority() const
return priority;
}
+
+ExecutionNode* KeepDiceExecNode::getCopy() const
+{
+ KeepDiceExecNode* node = new KeepDiceExecNode();
+ node->setDiceKeepNumber(m_numberOfDice);
+ if(NULL!=m_nextNode)
+ {
+ node->setNextNode(m_nextNode->getCopy());
+ }
+ return node;
+
+}