aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cli
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2020-07-01 00:00:27 +0200
committerRenaud Guezennec <renaud@rolisteam.org>2020-08-01 19:35:02 +0000
commit591fbbd71b10a5f086fab622f7dfe43f3a8adcb6 (patch)
tree3ccfff5317eaa75a03cb5f1fa8128a16217dae96 /cli
parenteb5e5c0b9c3ea6b8fe384e601cb93b0114cf7842 (diff)
downloadOneRoll-591fbbd71b10a5f086fab622f7dfe43f3a8adcb6.tar.gz
OneRoll-591fbbd71b10a5f086fab622f7dfe43f3a8adcb6.zip
Fix some behaviours about
Diffstat (limited to 'cli')
-rw-r--r--cli/main.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/cli/main.cpp b/cli/main.cpp
index 3de1d26..004e187 100644
--- a/cli/main.cpp
+++ b/cli/main.cpp
@@ -161,7 +161,7 @@ void displayMarkdown(QString scalarText, QString resultStr, QJsonArray array, bo
}
else if(!resultStr.isEmpty())
{
- resultStr.replace("%2", diceList.trimmed());
+ // resultStr.replace("%2", diceList.trimmed());
str.append(QStringLiteral("%1\n").arg(resultStr));
}
}
@@ -374,6 +374,15 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
if(sub.contains(ex))
resultWithPlaceHolder.append(sub);
});
+
+ if(resultWithPlaceHolder.isEmpty())
+ allStringlist.erase(std::remove_if(allStringlist.begin(), allStringlist.end(),
+ [](const QString& result) {
+ bool ok;
+ result.toInt(&ok);
+ return ok;
+ }),
+ allStringlist.end());
auto stringResult
= resultWithPlaceHolder.isEmpty() ? allStringlist.join(" ; ") : resultWithPlaceHolder.join(" ; ");
@@ -394,9 +403,10 @@ int startDiceParsing(QStringList& cmds, QString& treeFile, bool withColor, EXPOR
stringResult.replace(QStringLiteral("µ%1").arg(i), (*it));
--i;
}
+
bool isInt= true;
stringResult.toInt(&isInt);
- if(!isInt)
+ if(!isInt || !resultWithPlaceHolder.isEmpty())
resultStr= stringResult;
}
if(format == BOT)