diff options
| author | 2018-11-11 17:38:53 +0100 | |
|---|---|---|
| committer | 2018-11-11 17:38:53 +0100 | |
| commit | 750cc31e9157bf92f54a66b8a076e5287c4cef3a (patch) | |
| tree | 8931522a6b82cf82f997029ef76608243a27e904 /diceparser.cpp | |
| parent | bd4a0c837bd5e3b4dbf9d3dcef892850d04ec6ac (diff) | |
| parent | 1d8bd391b1df4fd2f2f274828db14c9ce695eb8b (diff) | |
| download | OneRoll-750cc31e9157bf92f54a66b8a076e5287c4cef3a.tar.gz OneRoll-750cc31e9157bf92f54a66b8a076e5287c4cef3a.zip | |
Merge branch 'diceResult'
Diffstat (limited to 'diceparser.cpp')
| -rw-r--r-- | diceparser.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/diceparser.cpp b/diceparser.cpp index 6108eb8..3e90fe8 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -492,6 +492,36 @@ QStringList DiceParser::getAllDiceResult(bool& hasAlias) return stringListResult; } + +void DiceParser::getDiceResultFromAllInstruction(QList<ExportedDiceResult>& resultList) +{ + for(auto start : m_startNodes) + { + ExecutionNode* next = getLeafNode(start); + Result* result=next->getResult(); + ExportedDiceResult nodeResult; + while(nullptr!=result) + { + if(result->hasResultOfType(Result::DICE_LIST)) + { + DiceResult* diceResult = dynamic_cast<DiceResult*>(result); + QList<HighLightDice> list; + quint64 faces = 0; + + for(Die* die : diceResult->getResultList()) + { + faces = die->getFaces(); + HighLightDice hlDice(die->getListValue(),die->isHighlighted(),die->getColor(), die->hasBeenDisplayed(),die->getFaces()); + list.append(hlDice); + } + nodeResult.insert(static_cast<int>(faces),list); + } + result = result->getPrevious(); + } + resultList.append(nodeResult); + } +} + void DiceParser::getLastDiceResult(QList<ExportedDiceResult>& diceValuesList,bool& homogeneous) { for(auto start : m_startNodes) @@ -499,7 +529,6 @@ void DiceParser::getLastDiceResult(QList<ExportedDiceResult>& diceValuesList,boo ExportedDiceResult diceValues; ExecutionNode* next = getLeafNode(start); Result* result=next->getResult(); - while(nullptr!=result) { if(result->hasResultOfType(Result::DICE_LIST)) @@ -529,8 +558,7 @@ void DiceParser::getLastDiceResult(QList<ExportedDiceResult>& diceValuesList,boo valuesResult.append(i); } } - HighLightDice hlDice(valuesResult,die->isHighlighted(),die->getColor()); - //QPair<QList<quint64>,bool> pair(valuesResult,die->isHighlighted()); + HighLightDice hlDice(valuesResult,die->isHighlighted(),die->getColor(), die->hasBeenDisplayed(),0); listpair.append(hlDice); } } |