aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/paintnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-02-12 23:59:24 +0100
committerRenaud G <renaud@rolisteam.org>2019-02-12 23:59:24 +0100
commitf2051fb35b1ad49c4d940e6fbba2acc98b216e13 (patch)
tree03117f493191d35104ac37eba72e916d41c849f2 /node/paintnode.cpp
parent210a222b894caa3c8af38ccb6653db0fd8491f6e (diff)
downloadOneRoll-f2051fb35b1ad49c4d940e6fbba2acc98b216e13.tar.gz
OneRoll-f2051fb35b1ad49c4d940e6fbba2acc98b216e13.zip
clang format
Diffstat (limited to 'node/paintnode.cpp')
-rw-r--r--node/paintnode.cpp92
1 files changed, 41 insertions, 51 deletions
diff --git a/node/paintnode.cpp b/node/paintnode.cpp
index 8fea3f4..02c7230 100644
--- a/node/paintnode.cpp
+++ b/node/paintnode.cpp
@@ -1,29 +1,25 @@
/***************************************************************************
- * Copyright (C) 2015 by Renaud Guezennec *
- * http:://www.rolisteam.org/contact *
- * *
- * rolisteam is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
- ***************************************************************************/
+ * Copyright (C) 2015 by Renaud Guezennec *
+ * http:://www.rolisteam.org/contact *
+ * *
+ * rolisteam is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
#include "paintnode.h"
-ColorItem::ColorItem(QString str, int val)
- : m_colorNumber(val),m_color(str)
-{
-
-}
+ColorItem::ColorItem(QString str, int val) : m_colorNumber(val), m_color(str) {}
int ColorItem::colorNumber() const
{
@@ -32,7 +28,7 @@ int ColorItem::colorNumber() const
void ColorItem::setColorNumber(int colorNumber)
{
- m_colorNumber = colorNumber;
+ m_colorNumber= colorNumber;
}
QString ColorItem::color() const
@@ -40,50 +36,46 @@ QString ColorItem::color() const
return m_color;
}
-void ColorItem::setColor(const QString &color)
+void ColorItem::setColor(const QString& color)
{
- m_color = color;
+ m_color= color;
}
-
///////////////////////////////////
/// @brief PainterNode::PainterNode
///////////////////////////////////
-PainterNode::PainterNode()
- : ExecutionNode()
+PainterNode::PainterNode() : ExecutionNode()
{
- m_result = nullptr;
- m_nextNode = nullptr;
+ m_result= nullptr;
+ m_nextNode= nullptr;
}
-
PainterNode::~PainterNode()
{
- m_result = nullptr;
+ m_result= nullptr;
}
-
void PainterNode::run(ExecutionNode* previous)
{
- m_previousNode = previous;
- if(nullptr==previous)
+ m_previousNode= previous;
+ if(nullptr == previous)
{
m_errors.insert(ExecutionNode::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)
+ Result* previousResult= previous->getResult();
+ // m_result = previousResult;
+ DiceResult* previousDiceResult= dynamic_cast<DiceResult*>(previousResult);
+ if(nullptr != previousDiceResult)
{
- QList<Die*> diceList=previousDiceResult->getResultList();
- int pastDice=0;
+ QList<Die*> diceList= previousDiceResult->getResultList();
+ int pastDice= 0;
for(ColorItem& item : m_colors)
{
- int current=item.colorNumber();
+ int current= item.colorNumber();
QList<Die*>::iterator it;
- for(it = diceList.begin()+pastDice; it != diceList.end() && current>0 ; ++it)
+ for(it= diceList.begin() + pastDice; it != diceList.end() && current > 0; ++it)
{
(*it)->setColor(item.color());
--current;
@@ -91,14 +83,14 @@ void PainterNode::run(ExecutionNode* previous)
}
}
}
- if(nullptr!=m_nextNode)
+ if(nullptr != m_nextNode)
{
m_nextNode->run(previous);
}
}
Result* PainterNode::getResult()
{
- return (nullptr != m_previousNode) ? m_previousNode->getResult() : nullptr ;
+ return (nullptr != m_previousNode) ? m_previousNode->getResult() : nullptr;
}
QString PainterNode::toString(bool wl) const
@@ -113,22 +105,20 @@ QString PainterNode::toString(bool wl) const
}
}
-
qint64 PainterNode::getPriority() const
{
return 4;
}
-
void PainterNode::insertColorItem(QString color, int value)
{
- ColorItem item(color,value);
+ ColorItem item(color, value);
m_colors.append(item);
}
ExecutionNode* PainterNode::getCopy() const
{
- PainterNode* node = new PainterNode();
- if(nullptr!=m_nextNode)
+ PainterNode* node= new PainterNode();
+ if(nullptr != m_nextNode)
{
node->setNextNode(m_nextNode->getCopy());
}