aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node/valueslistnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2019-07-10 11:49:45 +0200
committerRenaud G <renaud@rolisteam.org>2019-07-10 11:49:45 +0200
commit9317fc5571784bafdd6d5de88f2e86e55b646648 (patch)
treedaeab58cc93a807379196c2656ef997fa13b1249 /node/valueslistnode.cpp
parent46b82f84e5c3407d4ce3f2d38c4309aa074b9a9e (diff)
downloadOneRoll-9317fc5571784bafdd6d5de88f2e86e55b646648.tar.gz
OneRoll-9317fc5571784bafdd6d5de88f2e86e55b646648.zip
Add valueslistnode
Diffstat (limited to 'node/valueslistnode.cpp')
-rw-r--r--node/valueslistnode.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/node/valueslistnode.cpp b/node/valueslistnode.cpp
new file mode 100644
index 0000000..e022741
--- /dev/null
+++ b/node/valueslistnode.cpp
@@ -0,0 +1,58 @@
+#include "valueslistnode.h"
+
+ValuesListNode::ValuesListNode() : m_diceResult(new DiceResult())
+{
+ m_result= m_diceResult;
+}
+
+void ValuesListNode::run(ExecutionNode* previous)
+{
+ m_previousNode= previous;
+ for(auto node : m_data)
+ {
+ node->run(this);
+ auto result= node->getResult();
+ if(!result)
+ continue;
+ auto val= result->getResult(Result::SCALAR).toInt();
+ Die* die= new Die();
+ die->displayed();
+ die->insertRollValue(val);
+ m_diceResult->insertResult(die);
+ }
+
+ if(nullptr != m_nextNode)
+ {
+ m_nextNode->run(this);
+ }
+}
+
+void ValuesListNode::insertValue(ExecutionNode* value)
+{
+ m_data.push_back(value);
+}
+ExecutionNode* ValuesListNode::getCopy() const
+{
+ ValuesListNode* node= new ValuesListNode();
+ if(nullptr != m_nextNode)
+ {
+ node->setNextNode(m_nextNode->getCopy());
+ }
+ return node;
+}
+QString ValuesListNode::toString(bool wl) const
+{
+ if(wl)
+ {
+ return QString("%1 [label=\"ValuesListNode list:\"]").arg(m_id);
+ }
+ else
+ {
+ return m_id;
+ }
+}
+qint64 ValuesListNode::getPriority() const
+{
+ qint64 priority= 4;
+ return priority;
+}