From 4516fab0081b0db73b7401816a521453ab77ecc6 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Tue, 28 Nov 2017 10:35:26 +0100 Subject: add stuff to debug if operator in if operator --- node/ifnode.cpp | 8 +++--- node/stringnode.cpp | 77 +++-------------------------------------------------- 2 files changed, 8 insertions(+), 77 deletions(-) (limited to 'node') 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" <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("%1"); - 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("%1"); - list = patternColor.arg(allStringlist.join(' ')); - value = list; - } - else - { - value = m_diceParser->getStringResult().replace("\n","
"); - list = allStringlist.join(' '); - return true; - } - } - - return false; -}*/ qint64 StringNode::getPriority() const { qint64 priority=0; -- cgit v1.2.3-70-g09d2