From fb24013c7772ea80f1db0d9ff1d886d1676882cd Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 12 Feb 2017 11:06:12 +0100 Subject: -change API to fix DF dice. --- node/dicerollernode.cpp | 14 +++++++------- node/dicerollernode.h | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'node') diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp index 2641ab7..c3062c9 100644 --- a/node/dicerollernode.cpp +++ b/node/dicerollernode.cpp @@ -9,8 +9,8 @@ -DiceRollerNode::DiceRollerNode(quint64 faces,qint64 offset) - : m_faces(faces),m_diceResult(new DiceResult()),m_offset(offset) +DiceRollerNode::DiceRollerNode(quint64 max,qint64 min) + : m_max(max),m_diceResult(new DiceResult()),m_min(min) { m_result=m_diceResult; } @@ -33,8 +33,8 @@ void DiceRollerNode::run(ExecutionNode* previous) for(quint64 i=0; i < m_diceCount ; ++i) { Die* die = new Die(); - die->setFaces(m_faces); - die->setBase(m_offset); + die->setBase(m_min); + die->setMaxValue(m_max); die->roll(); //qDebug() << die->getValue() << "value"; m_diceResult->insertResult(die); @@ -49,13 +49,13 @@ void DiceRollerNode::run(ExecutionNode* previous) quint64 DiceRollerNode::getFaces() const { - return m_faces; + return abs(m_max-m_min)+1; } QString DiceRollerNode::toString(bool wl) const { if(wl) { - return QString("%1 [label=\"DiceRollerNode faces: %2\"]").arg(m_id).arg(m_faces); + return QString("%1 [label=\"DiceRollerNode faces: %2\"]").arg(m_id).arg(getFaces()); } else { @@ -75,7 +75,7 @@ qint64 DiceRollerNode::getPriority() const } ExecutionNode* DiceRollerNode::getCopy() const { - DiceRollerNode* node = new DiceRollerNode(m_faces,m_offset); + DiceRollerNode* node = new DiceRollerNode(m_max,m_min); if(NULL!=m_nextNode) { node->setNextNode(m_nextNode->getCopy()); diff --git a/node/dicerollernode.h b/node/dicerollernode.h index 4e2f9d7..ab5c47f 100644 --- a/node/dicerollernode.h +++ b/node/dicerollernode.h @@ -17,7 +17,7 @@ public: * @param faces, number of faces of dices * @param offset, first value of dice. */ - DiceRollerNode(quint64 faces, qint64 offset = 1); + DiceRollerNode(quint64 max, qint64 min = 1); /** * @brief run - starts to roll dice. @@ -46,9 +46,9 @@ public: //private members private: quint64 m_diceCount; - quint64 m_faces; /// faces + qint64 m_max; /// faces DiceResult* m_diceResult; - qint64 m_offset; + qint64 m_min; }; #endif // DICEROLLERNODE_H -- cgit v1.2.3-70-g09d2