aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2015-05-16 00:05:08 +0200
committerRenaud G <renaud@rolisteam.org>2015-05-16 00:05:08 +0200
commitbb89b91d9919ad9fed8b9d30ea0df79ceea4d3f7 (patch)
tree090223d5ab28601d52c63bb9489835f191cf797a /diceparser.cpp
parentb79df1fffd6677a584d6ad8ed44004aae0dad7b4 (diff)
parentf8a2e958e699ca41730cb785e7284c07eaaa5a82 (diff)
downloadOneRoll-bb89b91d9919ad9fed8b9d30ea0df79ceea4d3f7.tar.gz
OneRoll-bb89b91d9919ad9fed8b9d30ea0df79ceea4d3f7.zip
Merge branch 'master' of github.com:obiwankennedy/DiceParser
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index 1046ade..f6cb59a 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -519,6 +519,7 @@ bool DiceParser::readDice(QString& str,ExecutionNode* & node)
if(readDiceOperator(str,currentOperator))
{
int num;
+ int end;
if(currentOperator==D)
{
if(m_parsingToolbox->readNumber(str,num))
@@ -528,7 +529,6 @@ bool DiceParser::readDice(QString& str,ExecutionNode* & node)
m_errorMap.insert(ExecutionNode::BAD_SYNTAXE,QObject::tr("Dice with %1 face(s) does not exist. Please, put a value higher than 0").arg(num));
return false;
}
- qDebug() << num;
DiceRollerNode* drNode = new DiceRollerNode(num);
node = drNode;
ExecutionNode* current = drNode;
@@ -536,8 +536,20 @@ bool DiceParser::readDice(QString& str,ExecutionNode* & node)
{
current = getLatestNode(current);
}
+ return true;
+ }
+ else if(m_parsingToolbox->readDiceRange(str,num,end))
+ {
-
+ int face = abs(num - end)+1;
+ qDebug()<< num << end<< face;
+ DiceRollerNode* drNode = new DiceRollerNode(face,num);
+ node = drNode;
+ ExecutionNode* current = drNode;
+ while(readOption(str,current))
+ {
+ current = getLatestNode(current);
+ }
return true;
}
}