aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
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
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')
-rw-r--r--node/keepdiceexecnode.cpp7
-rw-r--r--node/keepdiceexecnode.h4
2 files changed, 8 insertions, 3 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;
}
diff --git a/node/keepdiceexecnode.h b/node/keepdiceexecnode.h
index 4212275..72d3de4 100644
--- a/node/keepdiceexecnode.h
+++ b/node/keepdiceexecnode.h
@@ -34,12 +34,12 @@ public:
virtual ~KeepDiceExecNode();
virtual void run(ExecutionNode *previous);
- virtual void setDiceKeepNumber(quint64 );
+ virtual void setDiceKeepNumber(qint64 );
virtual QString toString(bool)const;
virtual qint64 getPriority() const;
virtual ExecutionNode *getCopy() const;
private:
- quint64 m_numberOfDice;
+ qint64 m_numberOfDice;
DiceResult* m_diceResult;
};