aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-02-14 23:45:18 +0100
committerRenaud G <renaud@rolisteam.org>2019-03-23 17:58:32 +0100
commit1d962712fdba24078b6ce35a2d616cd3155cfc31 (patch)
tree13d888e3734d44d44b83732bfe35d20bb23a7584 /diceparser.cpp
parentc46ad9d1ceb345f09590ad8ea9a98b33a2a0c31b (diff)
downloadOneRoll-1d962712fdba24078b6ce35a2d616cd3155cfc31.tar.gz
OneRoll-1d962712fdba24078b6ce35a2d616cd3155cfc31.zip
add occurencecountnode
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index 5ec7122..9f018b4 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -39,6 +39,7 @@
#include "node/listsetrollnode.h"
#include "node/mergenode.h"
#include "node/numbernode.h"
+#include "node/occurencecountnode.h"
#include "node/paintnode.h"
#include "node/parenthesesnode.h"
#include "node/rerolldicenode.h"
@@ -78,6 +79,7 @@ DiceParser::DiceParser()
m_OptionOp->insert(QStringLiteral("u"), Split);
m_OptionOp->insert(QStringLiteral("g"), Group);
m_OptionOp->insert(QStringLiteral("b"), Bind);
+ m_OptionOp->insert(QStringLiteral("o"), Occurences);
m_aliasList= new QList<DiceAlias*>();
@@ -1113,6 +1115,31 @@ bool DiceParser::readOption(QString& str, ExecutionNode* previous) //,
found= true;
}
break;
+ case Occurences:
+ {
+ qint64 number= 0;
+ auto occNode= new OccurenceCountNode();
+ if(m_parsingToolbox->readNumber(str, number))
+ {
+ occNode->setWidth(number);
+ /*Validator* validator= m_parsingToolbox->readCompositeValidator(str);
+ if(validator)
+ {
+ occNode->setValidator(validator);
+ }*/
+ if(m_parsingToolbox->readComma(str))
+ {
+ if(m_parsingToolbox->readNumber(str, number))
+ {
+ occNode->setHeight(number);
+ previous->setNextNode(occNode);
+ node= occNode;
+ found= true;
+ }
+ }
+ }
+ }
+ break;
case Painter:
{
PainterNode* painter= new PainterNode();