aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2022-04-16 01:58:40 +0200
committerRenaud G <renaud@rolisteam.org>2022-04-16 02:59:30 +0200
commit6ba9324cf4864ebd2e2cdec8098b0889ceaea0a8 (patch)
treee29af0f803de724e28eab85da2dfe6c535a8292b /node
parent0c040da59e6aa2df3bd0c22e38b2afe0512d3749 (diff)
downloadOneRoll-6ba9324cf4864ebd2e2cdec8098b0889ceaea0a8.tar.gz
OneRoll-6ba9324cf4864ebd2e2cdec8098b0889ceaea0a8.zip
Make sure Windows compilation works
Diffstat (limited to 'node')
-rw-r--r--node/dicerollernode.cpp6
-rw-r--r--node/dicerollernode.h10
-rw-r--r--node/executionnode.h2
-rw-r--r--node/ifnode.h2
-rw-r--r--node/listaliasnode.h3
-rw-r--r--node/mergenode.cpp2
-rw-r--r--node/repeaternode.cpp29
-rw-r--r--node/replacevaluenode.cpp2
-rw-r--r--node/rerolldicenode.cpp4
-rw-r--r--node/scalaroperatornode.cpp35
-rw-r--r--node/scalaroperatornode.h6
-rw-r--r--node/switchcasenode.cpp2
-rw-r--r--node/variablenode.cpp4
13 files changed, 58 insertions, 49 deletions
diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp
index f87908f..2b00c0a 100644
--- a/node/dicerollernode.cpp
+++ b/node/dicerollernode.cpp
@@ -7,7 +7,7 @@
#include <QTime>
DiceRollerNode::DiceRollerNode(qint64 max, qint64 min)
- : m_max(max), m_diceResult(new DiceResult()), m_min(min), m_operator(Die::PLUS)
+ : m_max(max), m_diceResult(new DiceResult()), m_min(min), m_operator(Dice::ArithmeticOperator::PLUS)
{
m_result= m_diceResult;
}
@@ -99,12 +99,12 @@ ExecutionNode* DiceRollerNode::getCopy() const
return node;
}
-Die::ArithmeticOperator DiceRollerNode::getOperator() const
+Dice::ArithmeticOperator DiceRollerNode::getOperator() const
{
return m_operator;
}
-void DiceRollerNode::setOperator(const Die::ArithmeticOperator& dieOperator)
+void DiceRollerNode::setOperator(const Dice::ArithmeticOperator& dieOperator)
{
m_operator= dieOperator;
m_diceResult->setOperator(dieOperator);
diff --git a/node/dicerollernode.h b/node/dicerollernode.h
index 67d4074..52178cb 100644
--- a/node/dicerollernode.h
+++ b/node/dicerollernode.h
@@ -45,8 +45,8 @@ public:
virtual ExecutionNode* getCopy() const;
// private members
- Die::ArithmeticOperator getOperator() const;
- void setOperator(const Die::ArithmeticOperator& dieOperator);
+ Dice::ArithmeticOperator getOperator() const;
+ void setOperator(const Dice::ArithmeticOperator& dieOperator);
bool getUnique() const;
void setUnique(bool unique);
@@ -54,10 +54,10 @@ public:
private:
quint64 m_diceCount;
qint64 m_max; /// faces
- DiceResult* m_diceResult;
+ DiceResult* m_diceResult{nullptr};
qint64 m_min;
- Die::ArithmeticOperator m_operator;
- bool m_unique = false;
+ Dice::ArithmeticOperator m_operator;
+ bool m_unique{false};
};
#endif // DICEROLLERNODE_H
diff --git a/node/executionnode.h b/node/executionnode.h
index 6321c83..d1bdf66 100644
--- a/node/executionnode.h
+++ b/node/executionnode.h
@@ -1,8 +1,8 @@
#ifndef EXECUTIONNODE_H
#define EXECUTIONNODE_H
-#include "diceparserhelper.h"
#include "result/result.h"
+#include <diceparser/diceparserhelper.h>
/**
* @brief The ExecutionNode class
diff --git a/node/ifnode.h b/node/ifnode.h
index f0046f0..912d65c 100644
--- a/node/ifnode.h
+++ b/node/ifnode.h
@@ -20,9 +20,9 @@
#ifndef IFNODE_H
#define IFNODE_H
-#include "diceparserhelper.h"
#include "executionnode.h"
#include "result/diceresult.h"
+#include <diceparser/diceparserhelper.h>
class ValidatorList;
class PartialDiceRollNode : public ExecutionNode
diff --git a/node/listaliasnode.h b/node/listaliasnode.h
index b8b549c..2a6f96e 100644
--- a/node/listaliasnode.h
+++ b/node/listaliasnode.h
@@ -21,7 +21,8 @@
#ifndef LISTALIASNODE_H
#define LISTALIASNODE_H
-#include "dicealias.h"
+#include <diceparser/dicealias.h>
+
#include "executionnode.h"
#include "result/stringresult.h"
diff --git a/node/mergenode.cpp b/node/mergenode.cpp
index 7a521e3..096bb8c 100644
--- a/node/mergenode.cpp
+++ b/node/mergenode.cpp
@@ -21,7 +21,7 @@
***************************************************************************/
#include "mergenode.h"
-#include "parsingtoolbox.h"
+#include <diceparser/parsingtoolbox.h>
MergeNode::MergeNode() : m_diceResult(new DiceResult())
{
diff --git a/node/repeaternode.cpp b/node/repeaternode.cpp
index 2010118..f93a9fe 100644
--- a/node/repeaternode.cpp
+++ b/node/repeaternode.cpp
@@ -21,11 +21,12 @@
***************************************************************************/
#include "node/repeaternode.h"
-#include "diceparserhelper.h"
#include "executionnode.h"
-#include "parsingtoolbox.h"
+#include "result/scalarresult.h"
#include "result/stringresult.h"
#include <QDebug>
+#include <diceparser/diceparserhelper.h>
+#include <diceparser/parsingtoolbox.h>
using InstructionSet= std::vector<ExecutionNode*>;
@@ -82,16 +83,18 @@ void RepeaterNode::run(ExecutionNode* previousNode)
for(int i= 0; i < timeCount; ++i)
{
m_startingNodes.push_back(cmd);
- std::for_each(cmd.begin(), cmd.end(), [this, &resultVec](ExecutionNode* node) {
- node->run(this);
- auto end= ParsingToolBox::getLeafNode(node);
- auto leafResult= end->getResult();
-
- if(nullptr == leafResult)
- return;
-
- resultVec.push_back(leafResult);
- });
+ std::for_each(cmd.begin(), cmd.end(),
+ [this, &resultVec](ExecutionNode* node)
+ {
+ node->run(this);
+ auto end= ParsingToolBox::getLeafNode(node);
+ auto leafResult= end->getResult();
+
+ if(nullptr == leafResult)
+ return;
+
+ resultVec.push_back(leafResult);
+ });
cmd= makeCopy(m_cmd);
}
if(m_sumAll)
@@ -121,7 +124,7 @@ void RepeaterNode::run(ExecutionNode* previousNode)
m_result= string;
- //qDebug().noquote() << listOfStrResult.join('\n');
+ // qDebug().noquote() << listOfStrResult.join('\n');
}
if(nullptr != m_nextNode)
diff --git a/node/replacevaluenode.cpp b/node/replacevaluenode.cpp
index fbad5df..c313fb0 100644
--- a/node/replacevaluenode.cpp
+++ b/node/replacevaluenode.cpp
@@ -20,8 +20,8 @@
#include "replacevaluenode.h"
#include "diceresult.h"
-#include "parsingtoolbox.h"
#include <QDebug>
+#include <diceparser/parsingtoolbox.h>
ReplaceValueNode::ReplaceValueNode() : m_diceResult(new DiceResult)
{
diff --git a/node/rerolldicenode.cpp b/node/rerolldicenode.cpp
index e7bf0f0..fd8c258 100644
--- a/node/rerolldicenode.cpp
+++ b/node/rerolldicenode.cpp
@@ -1,5 +1,7 @@
+#include <diceparser/parsingtoolbox.h>
+
#include "rerolldicenode.h"
-#include "parsingtoolbox.h"
+#include "validatorlist.h"
#include <utility>
RerollDiceNode::RerollDiceNode(bool reroll, bool addingMode)
diff --git a/node/scalaroperatornode.cpp b/node/scalaroperatornode.cpp
index 268d6b8..c1c4dc5 100644
--- a/node/scalaroperatornode.cpp
+++ b/node/scalaroperatornode.cpp
@@ -25,7 +25,7 @@
#include <QDebug>
ScalarOperatorNode::ScalarOperatorNode()
- : m_internalNode(nullptr), m_scalarResult(new ScalarResult()), m_arithmeticOperator(Die::PLUS)
+ : m_internalNode(nullptr), m_scalarResult(new ScalarResult()), m_arithmeticOperator(Dice::ArithmeticOperator::PLUS)
{
m_result= m_scalarResult;
}
@@ -75,28 +75,28 @@ void ScalarOperatorNode::run(ExecutionNode* previous)
switch(m_arithmeticOperator)
{
- case Die::PLUS:
+ case Dice::ArithmeticOperator::PLUS:
m_scalarResult->setValue(add(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal()));
break;
- case Die::MINUS:
+ case Dice::ArithmeticOperator::MINUS:
m_scalarResult->setValue(substract(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal()));
break;
- case Die::MULTIPLICATION:
+ case Dice::ArithmeticOperator::MULTIPLICATION:
m_scalarResult->setValue(multiple(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal()));
break;
- case Die::DIVIDE:
+ case Dice::ArithmeticOperator::DIVIDE:
m_scalarResult->setValue(divide(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal()));
break;
- case Die::INTEGER_DIVIDE:
+ case Dice::ArithmeticOperator::INTEGER_DIVIDE:
m_scalarResult->setValue(
static_cast<int>(divide(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal())));
break;
- case Die::POW:
+ case Dice::ArithmeticOperator::POW:
m_scalarResult->setValue(pow(previousResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal(),
internalResult->getResult(Dice::RESULT_TYPE::SCALAR).toReal()));
break;
@@ -149,12 +149,12 @@ qint64 ScalarOperatorNode::pow(qreal a, qreal b)
{
return static_cast<qint64>(std::pow(a, b));
}
-Die::ArithmeticOperator ScalarOperatorNode::getArithmeticOperator() const
+Dice::ArithmeticOperator ScalarOperatorNode::getArithmeticOperator() const
{
return m_arithmeticOperator;
}
-void ScalarOperatorNode::setArithmeticOperator(const Die::ArithmeticOperator& arithmeticOperator)
+void ScalarOperatorNode::setArithmeticOperator(const Dice::ArithmeticOperator& arithmeticOperator)
{
m_arithmeticOperator= arithmeticOperator;
}
@@ -164,22 +164,22 @@ QString ScalarOperatorNode::toString(bool wl) const
QString op= "";
switch(m_arithmeticOperator)
{
- case Die::PLUS:
+ case Dice::ArithmeticOperator::PLUS:
op= "+";
break;
- case Die::MINUS:
+ case Dice::ArithmeticOperator::MINUS:
op= "-";
break;
- case Die::MULTIPLICATION:
+ case Dice::ArithmeticOperator::MULTIPLICATION:
op= "*";
break;
- case Die::DIVIDE:
+ case Dice::ArithmeticOperator::DIVIDE:
op= "/";
break;
- case Die::INTEGER_DIVIDE:
+ case Dice::ArithmeticOperator::INTEGER_DIVIDE:
op= "|";
break;
- case Die::POW:
+ case Dice::ArithmeticOperator::POW:
op= "^";
break;
}
@@ -194,11 +194,12 @@ QString ScalarOperatorNode::toString(bool wl) const
}
qint64 ScalarOperatorNode::getPriority() const
{
- if((m_arithmeticOperator == Die::PLUS) || (m_arithmeticOperator == Die::MINUS))
+ if((m_arithmeticOperator == Dice::ArithmeticOperator::PLUS)
+ || (m_arithmeticOperator == Dice::ArithmeticOperator::MINUS))
{
return 1;
}
- else if(m_arithmeticOperator == Die::POW)
+ else if(m_arithmeticOperator == Dice::ArithmeticOperator::POW)
{
return 3;
}
diff --git a/node/scalaroperatornode.h b/node/scalaroperatornode.h
index 5902433..57a1049 100644
--- a/node/scalaroperatornode.h
+++ b/node/scalaroperatornode.h
@@ -81,12 +81,12 @@ public:
* @brief getArithmeticOperator
* @return
*/
- Die::ArithmeticOperator getArithmeticOperator() const;
+ Dice::ArithmeticOperator getArithmeticOperator() const;
/**
* @brief setArithmeticOperator
* @param arithmeticOperator
*/
- void setArithmeticOperator(const Die::ArithmeticOperator& arithmeticOperator);
+ void setArithmeticOperator(const Dice::ArithmeticOperator& arithmeticOperator);
/**
* @brief getCopy
@@ -121,7 +121,7 @@ private:
private:
ExecutionNode* m_internalNode;
ScalarResult* m_scalarResult;
- Die::ArithmeticOperator m_arithmeticOperator;
+ Dice::ArithmeticOperator m_arithmeticOperator;
};
#endif // SCALAROPERATORNODE_H
diff --git a/node/switchcasenode.cpp b/node/switchcasenode.cpp
index 61938a9..880fa4d 100644
--- a/node/switchcasenode.cpp
+++ b/node/switchcasenode.cpp
@@ -19,9 +19,9 @@
***************************************************************************/
#include "switchcasenode.h"
-#include "parsingtoolbox.h"
#include "stringresult.h"
#include <QDebug>
+#include <diceparser/parsingtoolbox.h>
SwitchCaseNode::SwitchCaseNode() : m_stringResult(new StringResult)
{
diff --git a/node/variablenode.cpp b/node/variablenode.cpp
index ce8af29..709ab46 100644
--- a/node/variablenode.cpp
+++ b/node/variablenode.cpp
@@ -1,5 +1,7 @@
#include "variablenode.h"
-#include "parsingtoolbox.h"
+
+#include "diceresult.h"
+#include <diceparser/parsingtoolbox.h>
VariableNode::VariableNode() {}