aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceresult.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2014-12-09 22:07:31 +0100
committerRenaud G <renaud@rolisteam.org>2014-12-09 22:07:31 +0100
commit2685e8e4fbbc480bbc9edf991faace7082987f38 (patch)
treefcd9b208f08a36346134de6c8ee3913b8d31fc2f /diceresult.cpp
parentfa1c05a58698d3a6c049479eb8f7d88ac9ddb348 (diff)
downloadOneRoll-2685e8e4fbbc480bbc9edf991faace7082987f38.tar.gz
OneRoll-2685e8e4fbbc480bbc9edf991faace7082987f38.zip
-New API for result type.
Diffstat (limited to 'diceresult.cpp')
-rw-r--r--diceresult.cpp33
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();