summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-10-08 02:02:52 +0200
committerPetr Mrázek <peterix@gmail.com>2017-10-08 02:02:52 +0200
commiteba8e61ce99577ab34f1164eabded1581742ef7b (patch)
treed75bc24fcfca1a84dfb37f8b39ec0ad9be97b575 /api
parentb88206907e4a716dc979998165cc09221734cdff (diff)
downloadMultiMC-eba8e61ce99577ab34f1164eabded1581742ef7b.tar
MultiMC-eba8e61ce99577ab34f1164eabded1581742ef7b.tar.gz
MultiMC-eba8e61ce99577ab34f1164eabded1581742ef7b.tar.lz
MultiMC-eba8e61ce99577ab34f1164eabded1581742ef7b.tar.xz
MultiMC-eba8e61ce99577ab34f1164eabded1581742ef7b.zip
NOISSUE change behaviour of the +tweakers patch item
Patch application will either add tweakers, or move them to the end if they are already present. This allows fixing up tweaker order in subsequent version patches.
Diffstat (limited to 'api')
-rw-r--r--api/logic/minecraft/MinecraftProfile.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/MinecraftProfile.cpp
index e6562230..a9552af2 100644
--- a/api/logic/minecraft/MinecraftProfile.cpp
+++ b/api/logic/minecraft/MinecraftProfile.cpp
@@ -428,12 +428,19 @@ void MinecraftProfile::applyTraits(const QSet<QString>& traits)
void MinecraftProfile::applyTweakers(const QStringList& tweakers)
{
- // FIXME: check for dupes?
- // FIXME: does order matter?
- for (auto tweaker : tweakers)
+ // if the applied tweakers override an existing one, skip it. this effectively moves it later in the sequence
+ QStringList newTweakers;
+ for(auto & tweaker: m_tweakers)
{
- this->m_tweakers += tweaker;
+ if (tweakers.contains(tweaker))
+ {
+ continue;
+ }
+ newTweakers.append(tweaker);
}
+ // then just append the new tweakers (or moved original ones)
+ newTweakers += tweakers;
+ m_tweakers = newTweakers;
}
void MinecraftProfile::applyJarMods(const QList<LibraryPtr>& jarMods)