aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-09-05 00:40:40 +0200
committerRenaud G <renaud@rolisteam.org>2019-09-05 00:40:40 +0200
commit1c875b651df3afafe1df6b8ae412124d67e526a6 (patch)
treee79f03a998c10f9d546b4ece060af68956bacca4 /diceparser.cpp
parentb0ec3dfffda7991eee5775dcebb04731ba6a8389 (diff)
downloadOneRoll-1c875b651df3afafe1df6b8ae412124d67e526a6.tar.gz
OneRoll-1c875b651df3afafe1df6b8ae412124d67e526a6.zip
Copy die but prevent them to be displayed twice.
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index ea8f251..702c47f 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -539,6 +539,7 @@ void DiceParser::getDiceResultFromAllInstruction(QList<ExportedDiceResult>& resu
void DiceParser::getLastDiceResult(QList<ExportedDiceResult>& diceValuesList, bool& homogeneous)
{
+ QStringList alreadySeenDice;
for(auto start : m_startNodes)
{
ExportedDiceResult diceValues;
@@ -559,23 +560,24 @@ void DiceParser::getLastDiceResult(QList<ExportedDiceResult>& diceValuesList, bo
ListDiceResult listpair;
for(auto& die : diceResult->getResultList())
{
- if(!die->hasBeenDisplayed())
+ if(die->hasBeenDisplayed() || alreadySeenDice.contains(die->getUuid()))
+ continue;
+
+ QList<qint64> valuesResult;
+ valuesResult.append(die->getValue());
+ die->displayed();
+ face= die->getFaces();
+ if(die->hasChildrenValue())
{
- QList<qint64> valuesResult;
- valuesResult.append(die->getValue());
- die->displayed();
- face= die->getFaces();
- if(die->hasChildrenValue())
+ for(qint64& i : die->getListValue())
{
- for(qint64& i : die->getListValue())
- {
- valuesResult.append(i);
- }
+ valuesResult.append(i);
}
- HighLightDice hlDice(valuesResult, die->isHighlighted(), die->getColor(),
- die->hasBeenDisplayed(), 0);
- listpair.append(hlDice);
}
+ HighLightDice hlDice(valuesResult, die->isHighlighted(), die->getColor(),
+ die->hasBeenDisplayed(), 0);
+ listpair.append(hlDice);
+ alreadySeenDice << die->getUuid();
}
if(!listpair.isEmpty())
{