aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/diceparser.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2018-12-16 18:15:11 +0100
committerRenaud G <renaud@rolisteam.org>2018-12-16 18:15:11 +0100
commit6cf27a39e9b8f8c5c463f431ae585381d8a7c25e (patch)
tree4f43f6329b1840fc7b5d30eb88d3ee6de8083abd /diceparser.cpp
parentb18145b6e97714fc093a261984b4248acb370151 (diff)
downloadOneRoll-6cf27a39e9b8f8c5c463f431ae585381d8a7c25e.tar.gz
OneRoll-6cf27a39e9b8f8c5c463f431ae585381d8a7c25e.zip
remove warning
To be Fixed - Dice Gui won't compile anymore
Diffstat (limited to 'diceparser.cpp')
-rw-r--r--diceparser.cpp103
1 files changed, 5 insertions, 98 deletions
diff --git a/diceparser.cpp b/diceparser.cpp
index 04e9af6..79e31f5 100644
--- a/diceparser.cpp
+++ b/diceparser.cpp
@@ -323,99 +323,6 @@ void DiceParser::start()
}
}
-QString DiceParser::displayResult()
-{
- QStringList resultList;
- for(auto start : m_startNodes)
- {
- ExecutionNode* next = start;
- int nodeCount=0;
- int resulCount=0;
- while(nullptr != next->getNextNode() )
- {
- next = next->getNextNode();
- ++nodeCount;
- }
- //////////////////////////////////
- //
- // Display
- //
- //////////////////////////////////
-
- QString str;
- QTextStream stream(&str);
- Result* result=next->getResult();
-
- QString totalValue("you got %1 ;");
- QString dieValue("D%1 : {%2} ");
-
- bool scalarDone=false;
- while(nullptr!=result)
- {
- ++resulCount;
- if((result->hasResultOfType(Result::SCALAR))&&(!scalarDone))
- {
- stream << totalValue.arg(result->getResult(Result::SCALAR).toReal()) << endl; //.arg(m_command)
- scalarDone=true;
- }
- else if(result->hasResultOfType(Result::DICE_LIST))
- {
-
- DiceResult* myDiceResult = dynamic_cast<DiceResult*>(result);
- if(nullptr!=myDiceResult)
- {
-
- QString resulStr;
- quint64 face=0;
- for(Die* die : myDiceResult->getResultList())
- {
- if(!die->hasBeenDisplayed())
- {
- resulStr+=QStringLiteral("%1").arg(die->getValue());
- die->displayed();
- face = die->getFaces();
-
-
- if(die->hasChildrenValue())
- {
- resulStr+=QStringLiteral(" [");
- for(qint64 i : die->getListValue())
- {
- resulStr+=QStringLiteral("%1 ").arg(i);
- }
- resulStr.remove(resulStr.size()-1,1);
- resulStr+=QStringLiteral("]");
- }
- resulStr+=QStringLiteral(", ");
- }
- }
- resulStr.remove(resulStr.size()-2,2);
-
- if(!resulStr.isEmpty())
- {
- stream << dieValue.arg(face).arg(resulStr);
- }
-
- }
- }
- else if(result->hasResultOfType(Result::STRING))
- {
- stream << result->getResult(Result::STRING).toString();
- }
-
- result = result->getPrevious();
- }
-
- QTextStream out(stdout);
- out << str << "you rolled: " <<m_command << endl;
- out << endl;
-
-
- resultList << QStringLiteral("%1, you rolled:%3").arg(str.simplified()).arg(m_command) ;
- }
-
- return resultList.join('\n');
-}
QList<qreal> DiceParser::getLastIntegerResults()
{
QList<qreal> resultValues;
@@ -551,7 +458,7 @@ void DiceParser::getDiceResultFromAllInstruction(QList<ExportedDiceResult>& resu
HighLightDice hlDice(die->getListValue(),die->isHighlighted(),die->getColor(), die->hasBeenDisplayed(),die->getFaces());
list.append(hlDice);
}
- nodeResult.insert(static_cast<int>(faces),list);
+ nodeResult.insert(faces,list);
}
result = result->getPrevious();
}
@@ -663,7 +570,7 @@ bool DiceParser::hasResultOfType(Result::RESULT_TYPE type, ExecutionNode* node,
Result* result=next->getResult();
while((result!=nullptr)&&(!scalarDone))
{
- if(result->hasResultOfType(type) && ((!notthelast)||(notthelast && (nullptr!=result->getPrevious()))))
+ if(result->hasResultOfType(type) && ((!notthelast)||(nullptr!=result->getPrevious())))
{
scalarDone=true;
}
@@ -702,7 +609,7 @@ QList<qreal> DiceParser::getSumOfDiceResult()
}
int DiceParser::getStartNodeCount() const
{
- return m_startNodes.size();
+ return static_cast<int>(m_startNodes.size());
}
ExecutionNode* DiceParser::getLeafNode(ExecutionNode* start)
{
@@ -894,7 +801,7 @@ bool DiceParser::readInstructionList(QString& str)
{
latest = ParsingToolBox::getLatestNode(latest);
}
- keepParsing = (!str.isEmpty() & (before!=str));
+ keepParsing = (!str.isEmpty() && (before!=str));
}
}
if( !str.isEmpty() && readInstructionOperator(str[0]))
@@ -1058,7 +965,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//,
DiceRollerNode* nodeTmp = dynamic_cast<DiceRollerNode*>(previous);
if(nullptr!=nodeTmp)
{
- previous = addExplodeDiceNode(nodeTmp->getFaces(),previous);
+ previous = addExplodeDiceNode(static_cast<qint64>(nodeTmp->getFaces()),previous);
}
node = m_parsingToolbox->addSort(previous,ascending);