aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@buf.com>2015-05-15 14:47:28 +0200
committerRenaud G <renaud@buf.com>2015-05-15 14:47:28 +0200
commit5acbf79338f01857f4d646727cd5f819c6de2183 (patch)
treee7bf1c0afdd32710fe754e87018820ec23fb9935 /diceparser.cpp
parente66b5fac468c30498d85148554d76bbd221df9c5 (diff)
downloadOneRoll-5acbf79338f01857f4d646727cd5f819c6de2183.tar.gz
OneRoll-5acbf79338f01857f4d646727cd5f819c6de2183.zip
add management for dice between range
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;
}
}