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.
This commit is contained in:
Petr Mrázek 2017-10-08 02:02:52 +02:00
parent b88206907e
commit eba8e61ce9

View File

@ -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)