diff options
| author | 2014-01-08 18:06:47 +0100 | |
|---|---|---|
| committer | 2014-01-08 18:06:47 +0100 | |
| commit | e60825292cfc852f7e4a211320d040a6d28b1157 (patch) | |
| tree | 6742c3afcc3d0eba71e586f557cff8798ec5e3ae /node/dicerollernode.cpp | |
| parent | 98551a48c1c13dbdb0d89e5e7a29888945947c52 (diff) | |
| download | OneRoll-e60825292cfc852f7e4a211320d040a6d28b1157.tar.gz OneRoll-e60825292cfc852f7e4a211320d040a6d28b1157.zip | |
Update dicerollernode.cpp
die*
Diffstat (limited to 'node/dicerollernode.cpp')
| -rw-r--r-- | node/dicerollernode.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp index 7530730..3c16a34 100644 --- a/node/dicerollernode.cpp +++ b/node/dicerollernode.cpp @@ -2,14 +2,13 @@ #include "die.h" -#include <QDateTime> + #include <QDebug> DiceRollerNode::DiceRollerNode(quint64 faces) : m_faces(faces),m_myDiceResult(new DiceResult()) { - uint seed = quintptr(this) + QDateTime::currentDateTime().toMSecsSinceEpoch(); - qsrand(seed); + m_result=m_myDiceResult; } @@ -20,8 +19,9 @@ void DiceRollerNode::run(ExecutionNode* previous) m_diceCount = previous->getResult()->getScalar(); for(quint64 i=0; i < m_diceCount ; ++i) { - Die die; - die.insertRollValue(rollDice()); + Die* die = new Die(); + die->setFaces(m_faces); + die->roll(); m_myDiceResult->insertResult(die); } if(NULL!=m_nextNode) @@ -30,7 +30,8 @@ void DiceRollerNode::run(ExecutionNode* previous) } } } -quint64 DiceRollerNode::rollDice() + +quint64 DiceRollerNode::getFaces() { - return (qrand()%m_faces)+1; + return m_faces; } |