diff options
| author | 2017-02-12 11:06:12 +0100 | |
|---|---|---|
| committer | 2017-02-12 11:06:12 +0100 | |
| commit | fb24013c7772ea80f1db0d9ff1d886d1676882cd (patch) | |
| tree | c41ee00ee0f3fd26e9af6c424d583fbaf0ffd0ef /node/dicerollernode.cpp | |
| parent | b0ddec64a03135484a7439a65de8486974f08499 (diff) | |
| download | OneRoll-fb24013c7772ea80f1db0d9ff1d886d1676882cd.tar.gz OneRoll-fb24013c7772ea80f1db0d9ff1d886d1676882cd.zip | |
-change API to fix DF dice.
Diffstat (limited to 'node/dicerollernode.cpp')
| -rw-r--r-- | node/dicerollernode.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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()); |