aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2018-08-22 02:07:30 +0200
committerRenaud G <renaud@rolisteam.org>2018-08-22 02:07:30 +0200
commit52343ff414f7b41e8f38e28bec3de39500b5fed2 (patch)
treeda96c1d107654c888f75a782bd780bbd66617ad5
parent16fbd4299406d069a142871a444c462f9a7fd57e (diff)
downloadOneRoll-52343ff414f7b41e8f38e28bec3de39500b5fed2.tar.gz
OneRoll-52343ff414f7b41e8f38e28bec3de39500b5fed2.zip
Fix bug on dicealias replacement (when several replacement must be done
on the same command).
-rw-r--r--dicealias.cpp6
-rw-r--r--dicealias.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/dicealias.cpp b/dicealias.cpp
index a27919d..f514e9e 100644
--- a/dicealias.cpp
+++ b/dicealias.cpp
@@ -89,9 +89,11 @@ QString makeReplament(const QString& pattern, const QString& replacement, QStrin
patternPosList.push_back(pos);
pos+=1;
}
- for(auto pos : patternPosList)
+
+ // TODO to be replace by C++14 when it is ready
+ for (auto i = patternPosList.rbegin(); i != patternPosList.rend(); ++i)
{
- cmd.replace(pos,1,replacement);
+ cmd.replace(*i,1,replacement);
}
}
}
diff --git a/dicealias.h b/dicealias.h
index a85c9a0..8320445 100644
--- a/dicealias.h
+++ b/dicealias.h
@@ -37,7 +37,7 @@ public:
* @param key
* @param isReplace
*/
- DiceAlias(QString cmd, QString key, bool isReplace = true, bool isEnable = true);
+ DiceAlias(QString pattern, QString remplacement, bool isReplace = true, bool isEnable = true);
/**
* @brief ~DiceAlias
*/