From 1e2c2131bfa90256817bc0299892af06bcfca608 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 21 Apr 2016 06:45:15 +0200 Subject: Fix error and warning from CppCheck --- die.cpp | 1 + node/countexecutenode.h | 2 +- node/dicerollernode.cpp | 2 +- node/dicerollernode.h | 2 +- node/rerolldicenode.h | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/die.cpp b/die.cpp index 7a79e88..1c52adb 100644 --- a/die.cpp +++ b/die.cpp @@ -43,6 +43,7 @@ Die::Die(const Die& die) m_faces = die.m_faces; m_highlighted = die.m_highlighted; m_base = die.m_base; + m_color = die.getColor(); } void Die::setValue(qint64 r) diff --git a/node/countexecutenode.h b/node/countexecutenode.h index 167ee82..15b2509 100644 --- a/node/countexecutenode.h +++ b/node/countexecutenode.h @@ -38,8 +38,8 @@ public: virtual qint64 getPriority() const; private: - Validator* m_validator; ScalarResult* m_scalarResult; + Validator* m_validator; }; #endif // COUNTEXECUTENODE_H diff --git a/node/dicerollernode.cpp b/node/dicerollernode.cpp index d8fe49c..e6f2950 100644 --- a/node/dicerollernode.cpp +++ b/node/dicerollernode.cpp @@ -46,7 +46,7 @@ void DiceRollerNode::run(ExecutionNode* previous) } } -quint64 DiceRollerNode::getFaces() +quint64 DiceRollerNode::getFaces() const { return m_faces; } diff --git a/node/dicerollernode.h b/node/dicerollernode.h index 808676f..2de1cfe 100644 --- a/node/dicerollernode.h +++ b/node/dicerollernode.h @@ -27,7 +27,7 @@ public: * @brief getFaces accessor * @return the face count */ - quint64 getFaces(); + quint64 getFaces() const; /** * @brief toString diff --git a/node/rerolldicenode.h b/node/rerolldicenode.h index f456bb3..2a98b4a 100644 --- a/node/rerolldicenode.h +++ b/node/rerolldicenode.h @@ -53,9 +53,9 @@ public: virtual qint64 getPriority() const; private: - Validator* m_validator; DiceResult* m_myDiceResult; bool m_adding; + Validator* m_validator; }; #endif // REROLLDICENODE_H -- cgit v1.2.3-70-g09d2 From 5824cd895d42fa83b7c756984f006e53d237c776 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 21 Apr 2016 06:55:13 +0200 Subject: fix cppcheck error. --- parsingtoolbox.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/parsingtoolbox.cpp b/parsingtoolbox.cpp index 7950e4d..705f777 100644 --- a/parsingtoolbox.cpp +++ b/parsingtoolbox.cpp @@ -27,8 +27,12 @@ QHash* ParsingToolBox::m_variableHash = NULL; ParsingToolBox::ParsingToolBox() + : m_logicOp(new QMap()), + m_logicOperation(new QMap()), + m_conditionOperation(new QMap()), + m_arithmeticOperation(new QHash()) { - m_logicOp = new QMap(); + //m_logicOp = ; m_logicOp->insert(">=",BooleanCondition::GreaterOrEqual); m_logicOp->insert("<=",BooleanCondition::LesserOrEqual); m_logicOp->insert("<",BooleanCondition::LesserThan); @@ -36,16 +40,16 @@ ParsingToolBox::ParsingToolBox() m_logicOp->insert(">",BooleanCondition::GreaterThan); - m_logicOperation = new QMap(); + //m_logicOperation = ; m_logicOperation->insert("|",CompositeValidator::OR); m_logicOperation->insert("^",CompositeValidator::EXCLUSIVE_OR); m_logicOperation->insert("&",CompositeValidator::AND); - m_conditionOperation = new QMap(); + // m_conditionOperation = ; m_conditionOperation->insert("%",OperationCondition::Modulo); - m_arithmeticOperation = new QHash(); + //m_arithmeticOperation = new QHash(); m_arithmeticOperation->insert(QStringLiteral("+"),ScalarOperatorNode::PLUS); m_arithmeticOperation->insert(QStringLiteral("-"),ScalarOperatorNode::MINUS); m_arithmeticOperation->insert(QStringLiteral("*"),ScalarOperatorNode::MULTIPLICATION); -- cgit v1.2.3-70-g09d2 From 7e41a91dfd78485ab94a064b8633dcbca28efe6e Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 21 Apr 2016 07:00:48 +0200 Subject: fix cpp check errors. --- result/result.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/result/result.cpp b/result/result.cpp index 3fa0aec..814ddb3 100644 --- a/result/result.cpp +++ b/result/result.cpp @@ -23,7 +23,7 @@ #include Result::Result() - : m_previous(NULL),m_resultTypes(NONE),m_id(QString("\"%1\"").arg(QUuid::createUuid().toString())) + : m_resultTypes(NONE),m_id(QString("\"%1\"").arg(QUuid::createUuid().toString())),m_previous(NULL) { } -- cgit v1.2.3-70-g09d2 From b5f0f2bfb2602a0cb3c19bed6772359f48eff428 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 28 Apr 2016 07:51:07 +0200 Subject: Fix percentage value for List operator. --- parsingtoolbox.cpp | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/parsingtoolbox.cpp b/parsingtoolbox.cpp index 705f777..38221f9 100644 --- a/parsingtoolbox.cpp +++ b/parsingtoolbox.cpp @@ -429,18 +429,11 @@ bool ParsingToolBox::readDiceRange(QString& str,qint64& start, qint64& end) str=str.remove(0,1); return true; } - else - { - return false; - } } } - else - { - return false; - } } } + return false; } ParsingToolBox::LIST_OPERATOR ParsingToolBox::readListOperator(QString& str) @@ -497,7 +490,7 @@ void ParsingToolBox::readProbability(QStringList& str,QList& ranges) int i=0; int j=0; //range - foreach(QString line,str) + for(QString line:str) { int pos = line.indexOf('['); if(-1!=pos) @@ -515,7 +508,7 @@ void ParsingToolBox::readProbability(QStringList& str,QList& ranges) totalDistance += end-start+1; ++i; } - else + else//pourcentage { Range range; range.setStart(start); @@ -532,29 +525,25 @@ void ParsingToolBox::readProbability(QStringList& str,QList& ranges) } - qint64 totalDistPourcent = totalDistance * undefDistance / (100-undefDistance); - - if(totalDistPourcent Date: Thu, 28 Apr 2016 18:53:14 +0200 Subject: Update HelpMe.md Add stuff on documentation --- HelpMe.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/HelpMe.md b/HelpMe.md index 3077195..8c0dc0f 100644 --- a/HelpMe.md +++ b/HelpMe.md @@ -58,12 +58,6 @@ Dice explose if their value are at the die maximum, the option sorts the resulti > klX -The option sorts the resulting die list and select the X lowest dice. - -### Keep Lower dice - -> klX - Dice explose if their value are at the die maximum, the option sorts the resulting die list, the it selects the X lowest dice. ### Sorting @@ -73,6 +67,7 @@ Dice explose if their value are at the die maximum, the option sorts the resulti The dice list is sorted in descending order. > 10d6sl + Roll 6 dice at 6 faces and then sort them ascendingly ### Counter @@ -223,6 +218,12 @@ The Rolisteam Dice Parser allows you to use several logic operator: * Lesser : < * Greater : > +## Select value from List + +The L operator (meaning list) can offer you the opportunity to pick up value from list. + +> 1L[sword,bow,knife,gun,shotgun] + ## Examples > 3D100 -- cgit v1.2.3-70-g09d2 From f34506d0795069a1be216c2c1a5c11c0b369efa6 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 30 Apr 2016 23:47:09 +0200 Subject: Add doxy page. --- diceparser.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/diceparser.h b/diceparser.h index b532b3e..96fc0a2 100644 --- a/diceparser.h +++ b/diceparser.h @@ -40,20 +40,26 @@ typedef QMap ExportedDiceResult; class ExploseDiceNode; /** - * @page DiceParser + * @page DiceParser Dice Parser + * + * @section Intro Introduction + * Diceparser is the software component dedicated to compute dice command in rolisteam.
+ * + * @section grammar The Grammar * * The grammar is something like this: * - * Line =: Command | Command;Command - * Command =: Expression | ScalarOperator Expression | ScalarOperator NodeAction Expression - * Expression =: number | number Dice | Command - * Dice =: DiceOperator Number(faces) | DiceOperator List - * List =: [Word,Number,',']+ - * NodeAction =: @ - * DiceOperator =: [D,L] - * ScalarOperator =: [x,-,*,x,/] - * number =: [0-9]+ - * Word =: [A-z]+ + * Line =: Command | Command;Command
+ * Command =: Expression | ScalarOperator Expression | ScalarOperator NodeAction Expression
+ * Expression =: number | number Dice | Command
+ * Dice =: DiceOperator Number(faces) | DiceOperator List
+ * List =: [Word[range|percentage],Number[range|percentage],',']+
+ * Persentage =: Number
+ * NodeAction =: @
+ * DiceOperator =: [D,L]
+ * ScalarOperator =: [x,-,*,x,/]
+ * number =: [0-9]+
+ * Word =: [A-z]+
* */ -- cgit v1.2.3-70-g09d2