From eba8e61ce99577ab34f1164eabded1581742ef7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 8 Oct 2017 02:02:52 +0200 Subject: [PATCH] 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. --- api/logic/minecraft/MinecraftProfile.cpp | 15 +++++++++++---- 1 file 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& 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& jarMods)