diff options
| author | 2014-12-09 22:07:31 +0100 | |
|---|---|---|
| committer | 2014-12-09 22:07:31 +0100 | |
| commit | 2685e8e4fbbc480bbc9edf991faace7082987f38 (patch) | |
| tree | fcd9b208f08a36346134de6c8ee3913b8d31fc2f /diceresult.cpp | |
| parent | fa1c05a58698d3a6c049479eb8f7d88ac9ddb348 (diff) | |
| download | OneRoll-2685e8e4fbbc480bbc9edf991faace7082987f38.tar.gz OneRoll-2685e8e4fbbc480bbc9edf991faace7082987f38.zip | |
-New API for result type.
Diffstat (limited to 'diceresult.cpp')
| -rw-r--r-- | diceresult.cpp | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/diceresult.cpp b/diceresult.cpp index f111ad4..7b73825 100644 --- a/diceresult.cpp +++ b/diceresult.cpp @@ -23,7 +23,7 @@ DiceResult::DiceResult() { - + m_resultTypes= (DICE_LIST | SCALAR); } void DiceResult::insertResult(Die* die) { @@ -38,17 +38,36 @@ void DiceResult::setResultList(QList<Die*> list) m_diceValues.clear(); m_diceValues << list; } -bool DiceResult::isScalar() const +//bool DiceResult::isScalar() const +//{ +// if(m_diceValues.size()==1) +// { +// return true; +// } +// return false; +//} +QVariant DiceResult::getResult(RESULT_TYPE type) { - if(m_diceValues.size()==1) + + switch (type) + { + case SCALAR: + return getScalarResult(); + break; + case DICE_LIST: { - return true; + + return QVariant(); + break; + } + default: + break; } - return false; + return QVariant(); + } -qreal DiceResult::getScalar() +qreal DiceResult::getScalarResult() { - if(m_diceValues.size()==1) { return m_diceValues[0]->getValue(); |