aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2015-12-24 11:21:35 +0100
committerRenaud G <renaud@rolisteam.org>2015-12-24 11:21:35 +0100
commit8572e4c63bf4c3b1decfb95e09960f899f198dd2 (patch)
tree884315ae7abf80ee247335df2eb3ee52c7e76e06
parent0332e66a2ff0fed8a307d2ec1deddaf4dc00c75e (diff)
downloadOneRoll-8572e4c63bf4c3b1decfb95e09960f899f198dd2.tar.gz
OneRoll-8572e4c63bf4c3b1decfb95e09960f899f198dd2.zip
-Add MergeOp and homogeneous status for result.
-rw-r--r--diceparser.cpp17
-rw-r--r--diceparser.h4
2 files changed, 18 insertions, 3 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index d07e555..0937733 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -38,6 +38,7 @@
#include "node/jumpbackwardnode.h"
#include "node/listsetrollnode.h"
#include "node/listaliasnode.h"
+#include "node/mergenode.h"
#define DEFAULT_FACES_NUMBER 10
@@ -59,6 +60,7 @@ DiceParser::DiceParser()
m_OptionOp->insert(QObject::tr("r"),Reroll);
m_OptionOp->insert(QObject::tr("e"),Explosing);
m_OptionOp->insert(QObject::tr("a"),RerollAndAdd);
+ m_OptionOp->insert(QObject::tr("m"),Merge);
//m_OptionOp->insert(QObject::tr("@"),JumpBackward);
@@ -443,7 +445,7 @@ QStringList DiceParser::getAllDiceResult(bool& hasAlias)
return stringListResult;
}
-void DiceParser::getLastDiceResult(ExportedDiceResult& diceValues)
+void DiceParser::getLastDiceResult(ExportedDiceResult& diceValues,bool& homogeneous)
{
ExecutionNode* next = getLeafNode();
Result* result=next->getResult();
@@ -455,6 +457,10 @@ void DiceParser::getLastDiceResult(ExportedDiceResult& diceValues)
DiceResult* diceResult = dynamic_cast<DiceResult*>(result);
if(NULL!=diceResult)
{
+ if(homogeneous)
+ {
+ homogeneous = diceResult->isHomogeneous();
+ }
quint64 face=0;
ListDiceResult listpair;
foreach(Die* die, diceResult->getResultList())
@@ -935,7 +941,16 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous, bool hasDice)/
m_errorMap.insert(ExecutionNode::BAD_SYNTAXE,QObject::tr("Validator is missing after the e operator. Please, change it"));
}
}
+ break;
+ case Merge:
+ {
+ MergeNode* mergeNode = new MergeNode();
+ previous->setNextNode(mergeNode);
+ node = mergeNode;
+ isFine = true;
+ }
+ break;
}
}
diff --git a/diceparser.h b/diceparser.h
index 6b9056f..045ec12 100644
--- a/diceparser.h
+++ b/diceparser.h
@@ -77,7 +77,7 @@ public:
/**
* @brief The OptionOperator enum gathering all options availables for result.
*/
- enum OptionOperator {KeepAndExplose,Keep,Reroll,Explosing,Sort,Count,RerollAndAdd};
+ enum OptionOperator {KeepAndExplose,Keep,Reroll,Explosing,Sort,Count,RerollAndAdd,Merge};
/**
* @brief The CommandOperator enum
*/
@@ -135,7 +135,7 @@ public:
* @brief getLastDiceResult
* @return
*/
- void getLastDiceResult(ExportedDiceResult& diceValues);
+ void getLastDiceResult(ExportedDiceResult& diceValues,bool& homogeneous);
/**
* @brief hasIntegerResultNotInFirst
* @return