diff options
Diffstat (limited to 'result')
| -rw-r--r-- | result/diceresult.cpp | 18 | ||||
| -rw-r--r-- | result/diceresult.h | 7 | ||||
| -rw-r--r-- | result/result.h | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/result/diceresult.cpp b/result/diceresult.cpp index 2f13210..31e316b 100644 --- a/result/diceresult.cpp +++ b/result/diceresult.cpp @@ -23,7 +23,7 @@ #include "diceresult.h" #include <QDebug> -DiceResult::DiceResult() : m_operator(Die::PLUS) +DiceResult::DiceResult() { m_resultTypes= (static_cast<int>(Dice::RESULT_TYPE::DICE_LIST) | static_cast<int>(Dice::RESULT_TYPE::SCALAR)); m_homogeneous= true; @@ -107,20 +107,20 @@ qreal DiceResult::getScalarResult() { switch(m_operator) { - case Die::PLUS: + case Dice::ArithmeticOperator::PLUS: scalar+= tmp->getValue(); break; - case Die::MULTIPLICATION: + case Dice::ArithmeticOperator::MULTIPLICATION: scalar*= tmp->getValue(); break; - case Die::MINUS: + case Dice::ArithmeticOperator::MINUS: scalar-= tmp->getValue(); break; - case Die::POW: + case Dice::ArithmeticOperator::POW: scalar= static_cast<int>(pow(static_cast<double>(scalar), static_cast<double>(tmp->getValue()))); break; - case Die::DIVIDE: - case Die::INTEGER_DIVIDE: + case Dice::ArithmeticOperator::DIVIDE: + case Dice::ArithmeticOperator::INTEGER_DIVIDE: if(tmp->getValue() != 0) { scalar/= tmp->getValue(); @@ -142,7 +142,7 @@ qreal DiceResult::getScalarResult() } } -Die::ArithmeticOperator DiceResult::getOperator() const +Dice::ArithmeticOperator DiceResult::getOperator() const { return m_operator; } @@ -152,7 +152,7 @@ void DiceResult::clear() m_diceValues.clear(); } -void DiceResult::setOperator(const Die::ArithmeticOperator& dieOperator) +void DiceResult::setOperator(const Dice::ArithmeticOperator& dieOperator) { m_operator= dieOperator; } diff --git a/result/diceresult.h b/result/diceresult.h index 8f15d3b..1b35b7e 100644 --- a/result/diceresult.h +++ b/result/diceresult.h @@ -24,6 +24,7 @@ #include <QList> #include <functional> +#include "diceparser/diceparserhelper.h" #include "die.h" #include "result.h" /** @@ -76,8 +77,8 @@ public: */ virtual void setHomogeneous(bool); - Die::ArithmeticOperator getOperator() const; - void setOperator(const Die::ArithmeticOperator& dieOperator); + Dice::ArithmeticOperator getOperator() const; + void setOperator(const Dice::ArithmeticOperator& dieOperator); bool contains(Die* die, const std::function<bool(const Die*, const Die*)> equal); void clear() override; @@ -90,7 +91,7 @@ protected: protected: QList<Die*> m_diceValues; bool m_homogeneous; - Die::ArithmeticOperator m_operator= Die::ArithmeticOperator::PLUS; + Dice::ArithmeticOperator m_operator{Dice::ArithmeticOperator::PLUS}; }; Q_DECLARE_METATYPE(QList<Die*>) #endif // DICERESULT_H diff --git a/result/result.h b/result/result.h index e86ed1f..4432682 100644 --- a/result/result.h +++ b/result/result.h @@ -22,9 +22,9 @@ #ifndef RESULT_H #define RESULT_H -#include "diceparserhelper.h" #include <QString> #include <QVariant> +#include <diceparser/diceparserhelper.h> /** * @brief The Result class */ |