diff options
| author | 2020-09-12 15:59:02 +0200 | |
|---|---|---|
| committer | 2020-09-12 15:59:02 +0200 | |
| commit | 2e6f5d9174b1ade9d3c3ff4a81b210313480a104 (patch) | |
| tree | e2cba1c6c0ace0ce5b5f4bd3a845167ed8b14a1f | |
| parent | 1f1ce3016fe8589d5b182e244e00333a1f35f1d0 (diff) | |
| download | OneRoll-2e6f5d9174b1ade9d3c3ff4a81b210313480a104.tar.gz OneRoll-2e6f5d9174b1ade9d3c3ff4a81b210313480a104.zip | |
fix output change.
| -rw-r--r-- | diceparser.cpp | 5 | ||||
| -rw-r--r-- | node/filternode.cpp | 1 | ||||
| -rw-r--r-- | node/keepdiceexecnode.h | 2 | ||||
| -rw-r--r-- | node/mergenode.cpp | 9 | ||||
| -rw-r--r-- | parsingtoolbox.cpp | 10 |
5 files changed, 20 insertions, 7 deletions
diff --git a/diceparser.cpp b/diceparser.cpp index d177d78..7f64b4b 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -276,6 +276,11 @@ QStringList DiceParser::stringResultFromEachInstruction(bool& hasAlias) const return m_parsingToolbox->allFirstResultAsString(hasAlias); } +void DiceParser::diceResultFromEachInstruction(QList<ExportedDiceResult>& resultList) const +{ + resultList= m_parsingToolbox->diceResultFromEachInstruction(); +} + QString DiceParser::comment() const { return m_parsingToolbox->getComment(); diff --git a/node/filternode.cpp b/node/filternode.cpp index 4424b4b..b72b6e1 100644 --- a/node/filternode.cpp +++ b/node/filternode.cpp @@ -47,6 +47,7 @@ void FilterNode::run(ExecutionNode* previous) for(Die* tmp : diceList) { tmp->setHighlighted(false); + tmp->setDisplayed(true); } m_diceResult->setResultList(diceList2); diff --git a/node/keepdiceexecnode.h b/node/keepdiceexecnode.h index 41d157d..49680f2 100644 --- a/node/keepdiceexecnode.h +++ b/node/keepdiceexecnode.h @@ -40,7 +40,7 @@ public: virtual ExecutionNode* getCopy() const; private: - qint64 m_numberOfDice; + qint64 m_numberOfDice= 0; DiceResult* m_diceResult; }; diff --git a/node/mergenode.cpp b/node/mergenode.cpp index 51a5024..441d306 100644 --- a/node/mergenode.cpp +++ b/node/mergenode.cpp @@ -21,6 +21,8 @@ ***************************************************************************/ #include "mergenode.h" +#include "parsingtoolbox.h" + MergeNode::MergeNode() : m_diceResult(new DiceResult()) { m_result= m_diceResult; @@ -41,7 +43,10 @@ void MergeNode::run(ExecutionNode* previous) { ExecutionNode* last= getLatestNode(start); if(nullptr == last || nullptr == previousLast) + { + previousLast= last; continue; + } auto startResult= start->getResult(); if(nullptr == startResult) @@ -55,7 +60,7 @@ void MergeNode::run(ExecutionNode* previous) while(nullptr != tmpResult) { DiceResult* dice= dynamic_cast<DiceResult*>(tmpResult); - if(nullptr == dice) + if(nullptr != dice) { ///@todo TODO improve here to set homogeneous while is really m_diceResult->setHomogeneous(false); @@ -93,11 +98,13 @@ void MergeNode::run(ExecutionNode* previous) m_nextNode->run(this); } } +#include <QDebug> ExecutionNode* MergeNode::getLatestNode(ExecutionNode* node) { ExecutionNode* next= node; while(nullptr != next->getNextNode() && (next->getNextNode() != this)) { + qDebug() << "find latest node" << next->toString(true) << next->getNextNode()->toString(true); next= next->getNextNode(); } return next; diff --git a/parsingtoolbox.cpp b/parsingtoolbox.cpp index 6224d13..f009155 100644 --- a/parsingtoolbox.cpp +++ b/parsingtoolbox.cpp @@ -1123,7 +1123,7 @@ QString ParsingToolBox::replaceVariableToValue(const QString& source, QStringLis do { auto ref= readVariableFromString(source, start); - if(ref.resultIndex() >= values.size()) + if(ref.resultIndex() > values.size()) { auto error= QString("No valid value at index: $%1").arg(ref.resultIndex()); errorMap.insert(Dice::ERROR_CODE::INVALID_INDEX, error); @@ -2357,7 +2357,7 @@ ExportedDiceResult ParsingToolBox::finalDiceResultFromInstruction(ExecutionNode* faces= die->getFaces(); HighLightDice hlDice(die->getListValue(), die->isHighlighted(), die->getColor(), die->hasBeenDisplayed(), die->getFaces(), die->getUuid()); - if(alreadyAdded.find(die->getUuid()) == alreadyAdded.end()) + if(alreadyAdded.find(die->getUuid()) == alreadyAdded.end() && !hlDice.displayed()) { list.append(hlDice); alreadyAdded.insert(die->getUuid()); @@ -2370,10 +2370,10 @@ ExportedDiceResult ParsingToolBox::finalDiceResultFromInstruction(ExecutionNode* nodeResult.insert(faces, vals); } } - if(nodeResult.isEmpty()) + /*if(nodeResult.isEmpty()) result= result->getPrevious(); - else - result= nullptr; + else*/ + result= result->getPrevious(); } return nodeResult; } |