diff options
| author | 2019-02-12 23:59:24 +0100 | |
|---|---|---|
| committer | 2019-02-12 23:59:24 +0100 | |
| commit | f2051fb35b1ad49c4d940e6fbba2acc98b216e13 (patch) | |
| tree | 03117f493191d35104ac37eba72e916d41c849f2 /node/explodedicenode.cpp | |
| parent | 210a222b894caa3c8af38ccb6653db0fd8491f6e (diff) | |
| download | OneRoll-f2051fb35b1ad49c4d940e6fbba2acc98b216e13.tar.gz OneRoll-f2051fb35b1ad49c4d940e6fbba2acc98b216e13.zip | |
clang format
Diffstat (limited to 'node/explodedicenode.cpp')
| -rw-r--r-- | node/explodedicenode.cpp | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/node/explodedicenode.cpp b/node/explodedicenode.cpp index 210f042..6df64ba 100644 --- a/node/explodedicenode.cpp +++ b/node/explodedicenode.cpp @@ -1,39 +1,38 @@ #include "explodedicenode.h" -ExplodeDiceNode::ExplodeDiceNode() - : m_diceResult(new DiceResult()),m_validator(nullptr) +ExplodeDiceNode::ExplodeDiceNode() : m_diceResult(new DiceResult()), m_validator(nullptr) { - m_result = m_diceResult; + m_result= m_diceResult; } void ExplodeDiceNode::run(ExecutionNode* previous) { - m_previousNode = previous; - if((nullptr!=previous)&&(nullptr!=previous->getResult())) + m_previousNode= previous; + if((nullptr != previous) && (nullptr != previous->getResult())) { - DiceResult* previous_result = dynamic_cast<DiceResult*>(previous->getResult()); + DiceResult* previous_result= dynamic_cast<DiceResult*>(previous->getResult()); m_result->setPrevious(previous_result); - if(nullptr!=previous_result) + if(nullptr != previous_result) { - for(auto& die: previous_result->getResultList()) + for(auto& die : previous_result->getResultList()) { - Die* tmpdie = new Die(); - *tmpdie=*die; + Die* tmpdie= new Die(); + *tmpdie= *die; m_diceResult->insertResult(tmpdie); die->displayed(); } - QList<Die*> list = m_diceResult->getResultList(); + QList<Die*> list= m_diceResult->getResultList(); - for(auto& die: list) + for(auto& die : list) { - while(m_validator->hasValid(die,false)) + while(m_validator->hasValid(die, false)) { die->roll(true); } } - // m_diceResult->setResultList(list); + // m_diceResult->setResultList(list); - if(nullptr!=m_nextNode) + if(nullptr != m_nextNode) { m_nextNode->run(this); } @@ -42,44 +41,44 @@ void ExplodeDiceNode::run(ExecutionNode* previous) } ExplodeDiceNode::~ExplodeDiceNode() { - if(nullptr!=m_validator) - { - delete m_validator; - } + if(nullptr != m_validator) + { + delete m_validator; + } } void ExplodeDiceNode::setValidator(Validator* val) { - m_validator = val; + m_validator= val; } QString ExplodeDiceNode::toString(bool withlabel) const { - if(withlabel) - { + if(withlabel) + { return QString("%1 [label=\"ExplodeDiceNode %2\"]").arg(m_id, m_validator->toString()); - } - else - { - return m_id; - } + } + else + { + return m_id; + } } qint64 ExplodeDiceNode::getPriority() const { - qint64 priority=0; - if(nullptr!=m_previousNode) + qint64 priority= 0; + if(nullptr != m_previousNode) { - priority = m_previousNode->getPriority(); + priority= m_previousNode->getPriority(); } return priority; } ExecutionNode* ExplodeDiceNode::getCopy() const { - ExplodeDiceNode* node = new ExplodeDiceNode(); - if(nullptr!=m_validator) + ExplodeDiceNode* node= new ExplodeDiceNode(); + if(nullptr != m_validator) { node->setValidator(m_validator->getCopy()); } - if(nullptr!=m_nextNode) + if(nullptr != m_nextNode) { node->setNextNode(m_nextNode->getCopy()); } |