diff options
| author | 2018-10-23 20:01:40 +0200 | |
|---|---|---|
| committer | 2018-10-23 20:01:40 +0200 | |
| commit | eef188c6cc953fcff9cf4491b0ae8256608caa14 (patch) | |
| tree | 8f3cae083a36d7ea022f4840659b0334a625903e /cli | |
| parent | 4b3134b843d4e211f9c93ee01178d431b5dce79f (diff) | |
| download | OneRoll-eef188c6cc953fcff9cf4491b0ae8256608caa14.tar.gz OneRoll-eef188c6cc953fcff9cf4491b0ae8256608caa14.zip | |
first draft for diceresult
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/main.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cli/main.cpp b/cli/main.cpp index dee3d05..30b05a3 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -242,6 +242,7 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF QString comment = parser.getComment(); QString error = parser.humanReadableError(); QStringList strLst; + QStringList listOfDiceResult; if(parser.hasIntegerResultNotInFirst()) { @@ -262,7 +263,41 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF } scalarText = QString("%1").arg(strLst.join(',')); } + if(!list.isEmpty()) + { + qDebug() << "list is not empty" << list.size(); + for(auto map : list) + { + qDebug() << "loop map"<< map.size(); + for(auto key : map.keys()) + { + qDebug() << "key: "<<key; + auto dice = map[key]; + QString stringVal; + for(auto val : dice) + { + qint64 total=0; + QStringList dicelist; + for(auto score: val.getResult()) + { + total += score; + dicelist << QString::number(score); + } + if(val.getResult().size() > 1) + { + stringVal=QString("%1 [%2]").arg(total).arg(dicelist.join(',')); + listOfDiceResult << stringVal; + } + else + { + listOfDiceResult << QString::number(total); + } + } + } + } + } + qDebug() << listOfDiceResult; if(parser.hasStringResult()) { bool ok; @@ -277,6 +312,11 @@ int startDiceParsing(QStringList& cmds,QString& treeFile,bool withColor, EXPORTF stringResult.replace(QStringLiteral("$%1").arg(i),(*it)); --i; } + for(auto it = strLst.rbegin(); it != strLst.rend() ; ++it) + { + stringResult.replace(QStringLiteral("µ%1").arg(i),(*it)); + --i; + } resultStr = stringResult; } |