aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/variablenode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2022-04-29 10:48:09 +0200
committerRenaud G <renaud@rolisteam.org>2022-04-29 10:48:09 +0200
commit07c5f6ec23fcf9237a24e71adcfacabce677f818 (patch)
tree588e8c5f82b9163181fad3581f610e6f1d88cba4 /node/variablenode.cpp
parenta9153f1615a842cfb9e9bcda4d9071e202618569 (diff)
downloadOneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.tar.gz
OneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.zip
Change file organization.
Diffstat (limited to 'node/variablenode.cpp')
-rw-r--r--node/variablenode.cpp112
1 files changed, 0 insertions, 112 deletions
diff --git a/node/variablenode.cpp b/node/variablenode.cpp
deleted file mode 100644
index 709ab46..0000000
--- a/node/variablenode.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "variablenode.h"
-
-#include "diceresult.h"
-#include <diceparser/parsingtoolbox.h>
-
-VariableNode::VariableNode() {}
-
-void VariableNode::run(ExecutionNode* previous)
-{
- m_previousNode= previous;
- if((nullptr != m_data) && (m_data->size() > m_index))
- {
- auto value= (*m_data)[m_index];
- value= ParsingToolBox::getLeafNode(value);
- if(nullptr == value)
- return;
-
- auto result= value->getResult();
- if(!result)
- return;
-
- m_result= result->getCopy();
- auto diceResult= dynamic_cast<DiceResult*>(result);
- if(nullptr != diceResult)
- {
- for(auto& die : diceResult->getResultList())
- {
- die->setDisplayed(false);
- }
- }
-
- if(nullptr != m_nextNode)
- {
- m_nextNode->run(this);
- }
- }
- else
- {
- m_errors.insert(Dice::ERROR_CODE::NO_VARIBALE, QObject::tr("No variable at index:%1").arg(m_index + 1));
- }
-}
-
-void VariableNode::setDisplayed()
-{
- if(!m_result)
- return;
- auto diceResult= dynamic_cast<DiceResult*>(m_result);
- if(nullptr == diceResult)
- return;
-
- for(auto& die : diceResult->getResultList())
- {
- die->setDisplayed(true);
- }
-}
-
-QString VariableNode::toString(bool withLabel) const
-{
- if(withLabel)
- {
- return QString("%1 [label=\"VariableNode index: %2\"]").arg(m_id).arg(m_index + 1);
- }
- else
- {
- return m_id;
- }
-}
-
-qint64 VariableNode::getPriority() const
-{
- qint64 priority= 4;
- if(nullptr != m_previousNode)
- {
- priority= m_previousNode->getPriority();
- }
- return priority;
-}
-
-ExecutionNode* VariableNode::getCopy() const
-{
- VariableNode* node= new VariableNode();
- node->setIndex(m_index);
- if(nullptr != m_data)
- {
- node->setData(m_data);
- }
- if(nullptr != m_nextNode)
- {
- node->setNextNode(m_nextNode->getCopy());
- }
- return node;
-}
-
-quint64 VariableNode::getIndex() const
-{
- return m_index;
-}
-
-void VariableNode::setIndex(quint64 index)
-{
- m_index= index;
-}
-
-std::vector<ExecutionNode*>* VariableNode::getData() const
-{
- return m_data;
-}
-
-void VariableNode::setData(std::vector<ExecutionNode*>* data)
-{
- m_data= data;
-}