aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/keepdiceexecnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2018-10-12 10:19:14 +0200
committerRenaud G <renaud@rolisteam.org>2018-10-12 10:19:36 +0200
commit49aca14b5d64b94c8db95ee9caffb90c00eab3fe (patch)
tree97f54c198da19eb8ea5a5c4e0a72fb941ee4ffdf /node/keepdiceexecnode.cpp
parentfe9b3dd57e908931bf303b0e11432427680976ab (diff)
downloadOneRoll-49aca14b5d64b94c8db95ee9caffb90c00eab3fe.tar.gz
OneRoll-49aca14b5d64b94c8db95ee9caffb90c00eab3fe.zip
Keep node accept negative number -1 means keep all dice but 1 (the lowest)
Diffstat (limited to 'node/keepdiceexecnode.cpp')
-rw-r--r--node/keepdiceexecnode.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/node/keepdiceexecnode.cpp b/node/keepdiceexecnode.cpp
index 89cda38..347931d 100644
--- a/node/keepdiceexecnode.cpp
+++ b/node/keepdiceexecnode.cpp
@@ -46,6 +46,11 @@ void KeepDiceExecNode::run(ExecutionNode* previous)
{
QList<Die*> diceList=previousDiceResult->getResultList();
+ if(m_numberOfDice < 0)
+ {
+ m_numberOfDice = diceList.size() + m_numberOfDice;
+ }
+
QList<Die*> diceList3= diceList.mid(0,m_numberOfDice);
QList<Die*> diceList2;
@@ -76,7 +81,7 @@ void KeepDiceExecNode::run(ExecutionNode* previous)
}
}
}
-void KeepDiceExecNode::setDiceKeepNumber(quint64 n)
+void KeepDiceExecNode::setDiceKeepNumber(qint64 n)
{
m_numberOfDice = n;
}