aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--booleancondition.cpp15
-rw-r--r--cli/main.cpp4
-rw-r--r--diceparser.cpp5
-rw-r--r--diceparser.h2
-rw-r--r--irc/botircdiceparser.cpp2
-rw-r--r--mobile/maincontroler.cpp2
-rw-r--r--node/dicerollernode.cpp2
-rw-r--r--node/ifnode.cpp6
-rw-r--r--node/numbernode.cpp2
-rw-r--r--node/startingnode.cpp18
10 files changed, 29 insertions, 29 deletions
diff --git a/booleancondition.cpp b/booleancondition.cpp
index 2a3e1b5..09140f7 100644
--- a/booleancondition.cpp
+++ b/booleancondition.cpp
@@ -41,7 +41,6 @@ qint64 BooleanCondition::hasValid(Die* b,bool recursive,bool unhighlight) const
qint64 sum= 0;
for(qint64 value: listValues)
{
- qDebug() << "value" << value << m_value;
switch(m_operator)
{
case Equal:
@@ -87,29 +86,29 @@ void BooleanCondition::setValue(qint64 v)
}
QString BooleanCondition::toString()
{
- QString str(QStringLiteral(""));
+ QString str(QStringLiteral(""));
switch (m_operator)
{
case Equal:
- str.append(QStringLiteral("="));
+ str.append(QStringLiteral("="));
break;
case GreaterThan:
- str.append(QStringLiteral(">"));
+ str.append(QStringLiteral(">"));
break;
case LesserThan:
- str.append(QStringLiteral("<"));
+ str.append(QStringLiteral("<"));
break;
case GreaterOrEqual:
- str.append(QStringLiteral(">="));
+ str.append(QStringLiteral(">="));
break;
case LesserOrEqual:
- str.append(QStringLiteral("<="));
+ str.append(QStringLiteral("<="));
break;
case Different:
str.append(QStringLiteral("!="));
break;
}
- return QStringLiteral("[%1%2]").arg(str).arg(m_value);
+ return QStringLiteral("[%1%2]").arg(str).arg(m_value);
}
quint64 BooleanCondition::getValidRangeSize(quint64 faces) const
{
diff --git a/cli/main.cpp b/cli/main.cpp
index 0672076..07a363b 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -234,7 +234,7 @@ void startDiceParsingMarkdown(QString cmd)
if(parser.parseLine(cmd))
{
- parser.Start();
+ parser.start();
if(!parser.getErrorMap().isEmpty())
{
result += "```markdown\n# Error:\n" + parser.humanReadableError() + "\n```";
@@ -309,7 +309,7 @@ void startDiceParsing(QStringList& cmds,QString& treeFile,bool highlight)
{
//
- parser->Start();
+ parser->start();
if(!parser->getErrorMap().isEmpty())
{
out << "Error" << parser->humanReadableError() << "\n";
diff --git a/diceparser.cpp b/diceparser.cpp
index d9871e2..44e69b4 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -282,6 +282,7 @@ bool DiceParser::readOptionFromNull(QString& str,ExecutionNode* & node)
if(readOption(str,&nodePrevious))
{
auto nodeNext = nodePrevious.getNextNode();
+ nodePrevious.setNextNode(nullptr);
node = nodeNext;
return true;
}
@@ -301,7 +302,7 @@ bool DiceParser::readNode(QString& str,ExecutionNode* & node)
return false;
}
-void DiceParser::Start()
+void DiceParser::start()
{
for(auto start : m_startNodes)
{
@@ -1176,7 +1177,7 @@ bool DiceParser::readBlocInstruction(QString& str,ExecutionNode*& resultnode)
if(str.startsWith('{'))
{
str=str.remove(0,1);
- ExecutionNode* node;
+ ExecutionNode* node = nullptr;
Die::ArithmeticOperator op;
ScalarOperatorNode* scalarNode = nullptr;
if(m_parsingToolbox->readArithmeticOperator(str,op))
diff --git a/diceparser.h b/diceparser.h
index 7cb1184..b844796 100644
--- a/diceparser.h
+++ b/diceparser.h
@@ -111,7 +111,7 @@ public:
* @brief Start running the execution tree
*
*/
- void Start();
+ void start();
/**
* @brief displayResult
diff --git a/irc/botircdiceparser.cpp b/irc/botircdiceparser.cpp
index 44a3224..f1a61f5 100644
--- a/irc/botircdiceparser.cpp
+++ b/irc/botircdiceparser.cpp
@@ -234,7 +234,7 @@ QString BotIrcDiceParser::startDiceParsing(QString& cmd,bool highlight)
if(m_parser->parseLine(cmd))
{
- m_parser->Start();
+ m_parser->start();
if(!m_parser->getErrorMap().isEmpty())
{
out << "Error" << m_parser->humanReadableError()<< "\n";
diff --git a/mobile/maincontroler.cpp b/mobile/maincontroler.cpp
index b0b3c02..c24e512 100644
--- a/mobile/maincontroler.cpp
+++ b/mobile/maincontroler.cpp
@@ -23,7 +23,7 @@ void MainControler::rollDice(QString cmd)
{
if(m_diceParser->parseLine(cmd))
{
- m_diceParser->Start();
+ m_diceParser->start();
for(int i = 0; i < m_diceParser->getStartNodeCount(); ++i)
{
//qDebug() << m_diceParser->getSumOfDiceResult(i);
diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp
index ed6d102..5a2ea04 100644
--- a/node/dicerollernode.cpp
+++ b/node/dicerollernode.cpp
@@ -38,7 +38,7 @@ void DiceRollerNode::run(ExecutionNode* previous)
die->setMaxValue(m_max);
die->roll();
//qDebug() << die->getValue() << "value";
- m_diceResult->insertResult(die);
+ m_diceResult->insertResult(die);
}
if(nullptr!=m_nextNode)
{
diff --git a/node/ifnode.cpp b/node/ifnode.cpp
index a74667d..c037121 100644
--- a/node/ifnode.cpp
+++ b/node/ifnode.cpp
@@ -21,7 +21,7 @@
#include "result/diceresult.h"
IfNode::IfNode()
- : m_validator(nullptr),m_true(nullptr),m_false(nullptr),m_conditionType(AllOfThem)
+ : m_validator(nullptr),m_conditionType(AllOfThem),m_true(nullptr),m_false(nullptr)
{
//m_result = new DiceResult();
}
@@ -96,12 +96,10 @@ void IfNode::run(ExecutionNode *previous)
bool result = m_validator->hasValid(dice,true,true);
trueForAll = trueForAll ? result : false;
falseForAll = falseForAll ? result : false;
- qDebug() << "result" << result;
oneIsTrue |= result;
oneIsFalse = !result ? true : oneIsFalse;
}
- qDebug() << "OneIsVrai: " << oneIsTrue <<" oneIsFaux" <<oneIsFalse<<" vraiForAll" <<trueForAll <<" fauxForAll" <<falseForAll << m_conditionType;
if(m_conditionType==OneOfThem)
{
if(oneIsTrue)
@@ -272,6 +270,8 @@ void IfNode::setConditionType(const IfNode::ConditionType &conditionType)
ExecutionNode* IfNode::getCopy() const
{
IfNode* node = new IfNode();
+
+ node->setConditionType(m_conditionType);
if(nullptr!=m_validator)
{
node->setValidator(m_validator->getCopy());
diff --git a/node/numbernode.cpp b/node/numbernode.cpp
index 26141c5..09325ae 100644
--- a/node/numbernode.cpp
+++ b/node/numbernode.cpp
@@ -38,7 +38,7 @@ NumberNode::~NumberNode()
void NumberNode::run(ExecutionNode* previous)
{
- m_previousNode = previous;
+ m_previousNode = previous;
if(nullptr!=previous)
{
m_result->setPrevious(previous->getResult());
diff --git a/node/startingnode.cpp b/node/startingnode.cpp
index 670dc7d..210606b 100644
--- a/node/startingnode.cpp
+++ b/node/startingnode.cpp
@@ -26,7 +26,7 @@ StartingNode::StartingNode()
}
void StartingNode::run(ExecutionNode*)
{
- m_previousNode = nullptr;
+ m_previousNode = nullptr;
if(nullptr!=m_nextNode)
{
m_nextNode->run(this);
@@ -34,14 +34,14 @@ void StartingNode::run(ExecutionNode*)
}
QString StartingNode::toString(bool withlabel) const
{
- if(withlabel)
- {
- return QString("%1 [label=\"StartingNode\"]").arg(m_id);
- }
- else
- {
- return m_id;
- }
+ if(withlabel)
+ {
+ return QString("%1 [label=\"StartingNode\"]").arg(m_id);
+ }
+ else
+ {
+ return m_id;
+ }
}