diff options
Diffstat (limited to 'node')
| -rw-r--r-- | node/ifnode.cpp | 8 | ||||
| -rw-r--r-- | node/stringnode.cpp | 77 |
2 files changed, 8 insertions, 77 deletions
diff --git a/node/ifnode.cpp b/node/ifnode.cpp index b40ed82..a74667d 100644 --- a/node/ifnode.cpp +++ b/node/ifnode.cpp @@ -96,10 +96,12 @@ void IfNode::run(ExecutionNode *previous) bool result = m_validator->hasValid(dice,true,true); trueForAll = trueForAll ? result : false; falseForAll = falseForAll ? result : false; + qDebug() << "result" << result; - oneIsTrue = (oneIsTrue==false) ? result : true; - oneIsFalse = (oneIsFalse==false) ? result : true; + oneIsTrue |= result; + oneIsFalse = !result ? true : oneIsFalse; } + qDebug() << "OneIsVrai: " << oneIsTrue <<" oneIsFaux" <<oneIsFalse<<" vraiForAll" <<trueForAll <<" fauxForAll" <<falseForAll << m_conditionType; if(m_conditionType==OneOfThem) { if(oneIsTrue) @@ -119,7 +121,7 @@ void IfNode::run(ExecutionNode *previous) } else if(falseForAll) { - nextNode = (nullptr==m_false) ? nullptr: m_false->getCopy(); + nextNode = (nullptr==m_false) ? nullptr: m_false->getCopy(); } } diff --git a/node/stringnode.cpp b/node/stringnode.cpp index af2fcda..5c489be 100644 --- a/node/stringnode.cpp +++ b/node/stringnode.cpp @@ -28,86 +28,15 @@ QString StringNode::toString(bool withLabel) const { if(withLabel) { - return QString("%1 [label=\"StringNode %2\"]").arg(m_id).arg(m_data); + QString dataCopy = m_data; + + return QString("%1 [label=\"StringNode %2\"]").arg(m_id).arg(dataCopy.replace('%','\\')); } else { return m_id; } } -/*void StringNode::getScalarResult() -{ - QString scalarText; - - if(m_diceParser->hasIntegerResultNotInFirst()) - { - scalarText = QStringLiteral("%1").arg(m_diceParser->getLastIntegerResult()); - } - else if(hasDiceList) - { - scalarText = QStringLiteral("%1").arg(m_diceParser->getSumOfDiceResult()); - } -}*/ - -/*bool StringNode::getMessageResult(QString& value, QString& command, QString& list) -{ - QString scalarText; - QString diceText; - //QString pattern(""); - - - - bool hasDiceList = false; - if(m_diceParser->hasDiceResult()) - { - ExportedDiceResult diceList; - bool ok; - m_diceParser->getLastDiceResult(diceList,ok);//fills the ExportedDiceResult - diceText = diceToText(diceList); - hasDiceList= true; - } - if(m_diceParser->hasSeparator()) - { - bool ok; - QStringList allStringlist = m_diceParser->getAllDiceResult(ok); - if(ok) - { - QString patternColor("<span class=\"dice\">%1</span>"); - list = patternColor.arg(allStringlist.join(' ')); - scalarText = list; - } - } - else if(m_diceParser->hasIntegerResultNotInFirst()) - { - scalarText = QStringLiteral("%1").arg(m_diceParser->getLastIntegerResult()); - } - else if(hasDiceList) - { - scalarText = QStringLiteral("%1").arg(m_diceParser->getSumOfDiceResult()); - } - value=scalarText; - list = diceText.trimmed(); - command = m_diceParser->getDiceCommand().toHtmlEscaped(); - if(m_diceParser->hasStringResult()) - { - bool ok; - QStringList allStringlist = m_diceParser->getAllStringResult(ok); - if(ok) - { - QString patternColor("<span class=\"dice\">%1</span>"); - list = patternColor.arg(allStringlist.join(' ')); - value = list; - } - else - { - value = m_diceParser->getStringResult().replace("\n","<br/>"); - list = allStringlist.join(' '); - return true; - } - } - - return false; -}*/ qint64 StringNode::getPriority() const { qint64 priority=0; |