diff options
| author | 2014-01-22 11:22:46 +0100 | |
|---|---|---|
| committer | 2014-01-22 11:22:46 +0100 | |
| commit | 6c0396515a8487b401e14a283fe61fb5bd134cb0 (patch) | |
| tree | bd10e672f58bb08dc89e0fdcf7de72a776845cd3 /diceparser.cpp | |
| parent | 520250f98a1e051bb182a27f0d83b3c99a06c040 (diff) | |
| download | OneRoll-6c0396515a8487b401e14a283fe61fb5bd134cb0.tar.gz OneRoll-6c0396515a8487b401e14a283fe61fb5bd134cb0.zip | |
Update diceparser.cpp
already displayed dice
Diffstat (limited to 'diceparser.cpp')
| -rw-r--r-- | diceparser.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/diceparser.cpp b/diceparser.cpp index e6b4d8f..c588dd4 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -35,11 +35,6 @@ DiceParser::DiceParser() m_aliasMap->insert("l5R","D10e10k"); m_aliasMap->insert("nwod","D10e10c[>7]"); m_aliasMap->insert("nwod","D10e10c[>7]"); - - - - - } ExecutionNode* DiceParser::getLatestNode(ExecutionNode* node) @@ -73,13 +68,13 @@ bool DiceParser::parseLine(QString str) ExecutionNode* current = getLatestNode(m_start); - qDebug() << "current" << current << " start"<< m_start << newNode; + keepParsing =!str.isEmpty(); if(keepParsing) { keepParsing = readOperator(str,current); - qDebug() << "2 current" << current << " start"<< m_start << newNode; + current = getLatestNode(current); } return true; @@ -169,35 +164,41 @@ void DiceParser::displayResult() quint64 face=0; foreach(Die* die, myDiceResult->getResultList()) { - resulStr+=QString("%1").arg(die->getValue()); - face = die->getFaces(); + if(!die->hasBeenDisplayed()) + { + resulStr+=QString("%1").arg(die->getValue()); + die->displayed(); + face = die->getFaces(); - if(die->hasChildrenValue()) - { - resulStr+=" ["; - foreach(qint64 i, die->getListValue()) + if(die->hasChildrenValue()) { + resulStr+=" ["; + foreach(qint64 i, die->getListValue()) + { - resulStr+=QString("%1 ").arg(i); + resulStr+=QString("%1 ").arg(i); + } + resulStr.remove(resulStr.size()-1,1); + resulStr+="]"; } - resulStr.remove(resulStr.size()-1,1); - resulStr+="]"; + resulStr+=", "; } - resulStr+=", "; - } resulStr.remove(resulStr.size()-2,2); - vectorDone = true; + if(!resulStr.isEmpty()) + { stream << dieValue.arg(face).arg(resulStr); + } } myResult = myResult->getPrevious(); } - qDebug() << str << "you rolled: " <<m_command << endl; + QTextStream out(stdout); + out << str << "you rolled: " <<m_command << endl; //qDebug() << "list:" << << " sum:" << << " command:" << command; |