diff options
| author | 2019-07-29 20:35:52 +0000 | |
|---|---|---|
| committer | 2019-07-29 20:35:52 +0000 | |
| commit | 1a902d383eef1e042d4462cd07b9384fcdf4d118 (patch) | |
| tree | 766b8ab720fa5da11730d2fc2388f51b9d14de49 /node/paintnode.cpp | |
| parent | f5906125576a8323a731c9456ce3dfc53b67ef59 (diff) | |
| parent | 0d4b68221bda594cc695d216dfa21306ddb69c85 (diff) | |
| download | OneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.tar.gz OneRoll-1a902d383eef1e042d4462cd07b9384fcdf4d118.zip | |
Merge branch 'liberation' into 'master'
Add fuzzer on the DiceParser
See merge request kde/rolisteam-diceparser!2
Diffstat (limited to 'node/paintnode.cpp')
| -rw-r--r-- | node/paintnode.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/node/paintnode.cpp b/node/paintnode.cpp index 02c7230..0cd4e10 100644 --- a/node/paintnode.cpp +++ b/node/paintnode.cpp @@ -47,7 +47,6 @@ void ColorItem::setColor(const QString& color) PainterNode::PainterNode() : ExecutionNode() { - m_result= nullptr; m_nextNode= nullptr; } @@ -61,15 +60,17 @@ void PainterNode::run(ExecutionNode* previous) m_previousNode= previous; if(nullptr == previous) { - m_errors.insert(ExecutionNode::NO_PREVIOUS_ERROR, QObject::tr("No previous node before Paint operator")); + m_errors.insert(Dice::ERROR_CODE::NO_PREVIOUS_ERROR, QObject::tr("No previous node before Paint operator")); return; } Result* previousResult= previous->getResult(); - // m_result = previousResult; - DiceResult* previousDiceResult= dynamic_cast<DiceResult*>(previousResult); - if(nullptr != previousDiceResult) + if(nullptr == previousResult) + return; + + m_diceResult= dynamic_cast<DiceResult*>(previousResult->getCopy()); + if(nullptr != m_diceResult) { - QList<Die*> diceList= previousDiceResult->getResultList(); + QList<Die*> diceList= m_diceResult->getResultList(); int pastDice= 0; for(ColorItem& item : m_colors) { @@ -90,7 +91,7 @@ void PainterNode::run(ExecutionNode* previous) } Result* PainterNode::getResult() { - return (nullptr != m_previousNode) ? m_previousNode->getResult() : nullptr; + return m_diceResult; } QString PainterNode::toString(bool wl) const |