aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-02-02 12:23:30 +0100
committerRenaud G <renaud@rolisteam.org>2019-02-02 12:23:34 +0100
commit210a222b894caa3c8af38ccb6653db0fd8491f6e (patch)
treeaa1f1b33091d4552973c558fdd4106f92a3cb53d
parent35f7acb8eb750631da2018f70b992e8043a1febb (diff)
downloadOneRoll-210a222b894caa3c8af38ccb6653db0fd8491f6e.tar.gz
OneRoll-210a222b894caa3c8af38ccb6653db0fd8491f6e.zip
remove warnings
-rw-r--r--die.cpp2
-rw-r--r--node/dicerollernode.cpp82
2 files changed, 40 insertions, 44 deletions
diff --git a/die.cpp b/die.cpp
index 5ba6137..3d372c8 100644
--- a/die.cpp
+++ b/die.cpp
@@ -155,7 +155,7 @@ void Die::roll(bool adding)
quint64 Die::getFaces() const
{
- return abs(m_maxValue - m_base) + 1;
+ return std::abs(m_maxValue - m_base) + 1;
}
qint64 Die::getLastRolledValue()
{
diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp
index 06daf7f..44b9e0a 100644
--- a/node/dicerollernode.cpp
+++ b/node/dicerollernode.cpp
@@ -1,61 +1,57 @@
#include "dicerollernode.h"
#include "die.h"
-
+#include <QDebug>
#include <QThread>
#include <QThreadPool>
-#include <QDebug>
#include <QTime>
-
-
-DiceRollerNode::DiceRollerNode(qint64 max,qint64 min)
- : m_max(max),m_diceResult(new DiceResult()),m_min(min),m_operator(Die::PLUS)
+DiceRollerNode::DiceRollerNode(qint64 max, qint64 min)
+ : m_max(max), m_diceResult(new DiceResult()), m_min(min), m_operator(Die::PLUS)
{
- m_result=m_diceResult;
+ m_result= m_diceResult;
}
void DiceRollerNode::run(ExecutionNode* previous)
{
- m_previousNode = previous;
- if(nullptr!=previous)
+ m_previousNode= previous;
+ if(nullptr != previous)
{
- Result* result=previous->getResult();
- if(nullptr!=result)
+ Result* result= previous->getResult();
+ if(nullptr != result)
{
- m_diceCount = static_cast<quint64>(result->getResult(Result::SCALAR).toReal());
+ m_diceCount= static_cast<quint64>(result->getResult(Result::SCALAR).toReal());
m_result->setPrevious(result);
if(m_diceCount == 0)
{
- m_errors.insert(NO_DICE_TO_ROLL,QObject::tr("No dice to roll"));
+ m_errors.insert(NO_DICE_TO_ROLL, QObject::tr("No dice to roll"));
}
- auto possibleValue = static_cast<quint64>(abs((m_max-m_min)+1));
- if( possibleValue < m_diceCount && m_unique)
+ auto possibleValue= static_cast<quint64>(std::abs((m_max - m_min) + 1));
+ if(possibleValue < m_diceCount && m_unique)
{
- m_errors.insert(TOO_MANY_DICE,QObject::tr("More unique values asked than possible values (D operator)"));
+ m_errors.insert(
+ TOO_MANY_DICE, QObject::tr("More unique values asked than possible values (D operator)"));
return;
}
- for(quint64 i=0; i < m_diceCount ; ++i)
+ for(quint64 i= 0; i < m_diceCount; ++i)
{
- Die* die = new Die();
+ Die* die= new Die();
die->setOp(m_operator);
die->setBase(m_min);
die->setMaxValue(m_max);
die->roll();
if(m_unique)
{
- const auto& equal = [](const Die* a,const Die* b){
- return a->getValue() == b->getValue();
- };
- while(m_diceResult->contains(die,equal))
+ const auto& equal= [](const Die* a, const Die* b) { return a->getValue() == b->getValue(); };
+ while(m_diceResult->contains(die, equal))
{
die->roll(false);
}
}
m_diceResult->insertResult(die);
}
- if(nullptr!=m_nextNode)
+ if(nullptr != m_nextNode)
{
m_nextNode->run(this);
}
@@ -65,37 +61,37 @@ void DiceRollerNode::run(ExecutionNode* previous)
quint64 DiceRollerNode::getFaces() const
{
- return abs(m_max-m_min)+1;
+ return std::abs(m_max - m_min) + 1;
}
-std::pair<qint64,qint64> DiceRollerNode::getRange() const
+std::pair<qint64, qint64> DiceRollerNode::getRange() const
{
- return std::make_pair(m_min,m_max);
+ return std::make_pair(m_min, m_max);
}
QString DiceRollerNode::toString(bool wl) const
{
- if(wl)
- {
+ if(wl)
+ {
return QString("%1 [label=\"DiceRollerNode faces: %2\"]").arg(m_id).arg(getFaces());
- }
- else
- {
- return m_id;
- }
+ }
+ else
+ {
+ return m_id;
+ }
}
qint64 DiceRollerNode::getPriority() const
{
- qint64 priority=4;
-// if(nullptr!=m_nextNode)
-// {
-// priority = m_nextNode->getPriority();
-// }
+ qint64 priority= 4;
+ // if(nullptr!=m_nextNode)
+ // {
+ // priority = m_nextNode->getPriority();
+ // }
return priority;
}
ExecutionNode* DiceRollerNode::getCopy() const
{
- DiceRollerNode* node = new DiceRollerNode(m_max,m_min);
- if(nullptr!=m_nextNode)
+ DiceRollerNode* node= new DiceRollerNode(m_max, m_min);
+ if(nullptr != m_nextNode)
{
node->setNextNode(m_nextNode->getCopy());
}
@@ -107,9 +103,9 @@ Die::ArithmeticOperator DiceRollerNode::getOperator() const
return m_operator;
}
-void DiceRollerNode::setOperator(const Die::ArithmeticOperator &dieOperator)
+void DiceRollerNode::setOperator(const Die::ArithmeticOperator& dieOperator)
{
- m_operator = dieOperator;
+ m_operator= dieOperator;
m_diceResult->setOperator(dieOperator);
}
@@ -120,5 +116,5 @@ bool DiceRollerNode::getUnique() const
void DiceRollerNode::setUnique(bool unique)
{
- m_unique = unique;
+ m_unique= unique;
}