From 3c93a8a938d313cbb2e5b880754ac726527a3e55 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Tue, 5 May 2015 10:35:03 +0200 Subject: removal of translatable string for commands --- diceparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index ebe2e0e..5831212 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -72,8 +72,8 @@ DiceParser::DiceParser() m_commandList = new QStringList(); - m_commandList->append(QObject::tr("help")); - m_commandList->append(QObject::tr("la")); + m_commandList->append("help"); + m_commandList->append("la"); } DiceParser::~DiceParser() -- cgit v1.2.3-70-g09d2 From baeb8276c07014f875ac8a2f5d4ec6883684adb3 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Tue, 5 May 2015 11:05:01 +0200 Subject: removal of space --- diceparser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index 5831212..8f38fe7 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -70,8 +70,7 @@ DiceParser::DiceParser() m_nodeActionMap = new QMap(); m_nodeActionMap->insert("@",JumpBackward); - - m_commandList = new QStringList(); + m_commandList = new QStringList(); m_commandList->append("help"); m_commandList->append("la"); -- cgit v1.2.3-70-g09d2 From 4c8d5865e3426092fa4c4724d22b31759aba6412 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Wed, 6 May 2015 07:42:11 +0200 Subject: add error message with zero faces dices --- diceparser.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index 8f38fe7..5108a10 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -202,11 +202,8 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) { parentheseNode->setNextNode(diceNode); } - return true; } - - } } else if(readOperand(str,operandNode)) @@ -526,9 +523,13 @@ bool DiceParser::readDice(QString& str,ExecutionNode* & node) { if(m_parsingToolbox->readNumber(str,num)) { + if(num<1) + { + 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); - // dice.m_diceOp = myOperator; - // dice.m_faces = num; node = drNode; ExecutionNode* current = drNode; while(readOption(str,current)) @@ -552,7 +553,7 @@ bool DiceParser::readDice(QString& str,ExecutionNode* & node) } else { - m_errorMap.insert(ExecutionNode::BAD_SYNTAXE,QObject::tr("List is missing after the L operator. Please, add it (e.g : 1L[sword,spear,gun,arrow]")); + m_errorMap.insert(ExecutionNode::BAD_SYNTAXE,QObject::tr("List is missing after the L operator. Please, add it (e.g : 1L[sword,spear,gun,arrow])")); } } -- cgit v1.2.3-70-g09d2 From 4ce233c2f8397c9792c3668b49e670a9dccdef95 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Wed, 6 May 2015 10:56:50 +0200 Subject: set the command line after the alias convertion. To prevent cheating --- diceparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index 5108a10..1046ade 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -151,12 +151,12 @@ bool DiceParser::parseLine(QString str) delete m_start; m_start = NULL; } - m_command = str; m_start = new StartingNode(); ExecutionNode* newNode = NULL; m_current = m_start; str = convertAlias(str); + m_command = str; bool keepParsing = readExpression(str,newNode); if(keepParsing) -- cgit v1.2.3-70-g09d2