From bb6b87a2685c0d71b5c38be33c100f85ac0b9cee Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 25 Jul 2019 09:59:29 +0200 Subject: Rework of the component to be a proper lib --- node/paintnode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'node/paintnode.cpp') diff --git a/node/paintnode.cpp b/node/paintnode.cpp index 02c7230..fe5a324 100644 --- a/node/paintnode.cpp +++ b/node/paintnode.cpp @@ -61,7 +61,7 @@ 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(); -- cgit v1.2.3-70-g09d2 From 32c8340e3163c97010c6ac5e60d01b52b4af063a Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 28 Jul 2019 02:15:54 +0200 Subject: Painter dice now have a copy of the result --- node/ifnode.cpp | 2 +- node/paintnode.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'node/paintnode.cpp') diff --git a/node/ifnode.cpp b/node/ifnode.cpp index 10b2f79..f0f28aa 100644 --- a/node/ifnode.cpp +++ b/node/ifnode.cpp @@ -41,7 +41,7 @@ void IfNode::run(ExecutionNode* previous) ExecutionNode* nextNode= nullptr; bool runNext= (nullptr == m_nextNode) ? false : true; Result* previousResult= previous->getResult(); - m_result= previousResult; + m_result= previousResult->getCopy(); if(nullptr != m_result) { diff --git a/node/paintnode.cpp b/node/paintnode.cpp index fe5a324..e0a7a74 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; } @@ -90,7 +89,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 -- cgit v1.2.3-70-g09d2 From fcf7b8145f3e576dddf5f710ec26c9ffc7d46f83 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 28 Jul 2019 02:33:43 +0200 Subject: Painter node add result --- node/paintnode.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'node/paintnode.cpp') diff --git a/node/paintnode.cpp b/node/paintnode.cpp index e0a7a74..0cd4e10 100644 --- a/node/paintnode.cpp +++ b/node/paintnode.cpp @@ -64,11 +64,13 @@ void PainterNode::run(ExecutionNode* previous) return; } Result* previousResult= previous->getResult(); - // m_result = previousResult; - DiceResult* previousDiceResult= dynamic_cast(previousResult); - if(nullptr != previousDiceResult) + if(nullptr == previousResult) + return; + + m_diceResult= dynamic_cast(previousResult->getCopy()); + if(nullptr != m_diceResult) { - QList diceList= previousDiceResult->getResultList(); + QList diceList= m_diceResult->getResultList(); int pastDice= 0; for(ColorItem& item : m_colors) { -- cgit v1.2.3-70-g09d2