From 0feb4b702d8a9eb1465c79c49ada5de01b67083d Mon Sep 17 00:00:00 2001 From: Tannin Date: Sun, 8 Jun 2014 15:10:08 +0200 Subject: - loot client now only updates the masterlist once per MO session - new event to notify plugins of changed mod priority - overwrite now shows up in the "checked" category instead of "unchecked" - display of "foreign" mods can now be limited to only official content - bugfix: bsa extraction dialog showed up even if the plugin was disabled - bugfix: after detection of foreign mods the priority of the overwrite folder could get messed up - bugfix: when displaying only the context menu for the mod list as a whole, the menu didn't disappear - bugfix: MO crashed when trying to download via the integrated browser --- src/profile.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index 2d982790..c3d9a0c4 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -296,6 +296,8 @@ void Profile::refreshModStatus() int numKnownMods = index; + int topInsert = 0; + // invert priority order to match that of the pluginlist. Also // give priorities to mods not referenced in the profile for (size_t i = 0; i < m_ModStatus.size(); ++i) { @@ -310,11 +312,28 @@ void Profile::refreshModStatus() if (static_cast(index) >= m_ModStatus.size()) { throw MyException(tr("invalid index %1").arg(index)); } - m_ModStatus[i].m_Priority = index++; + if (modInfo->hasFlag(ModInfo::FLAG_FOREIGN)) { + m_ModStatus[i].m_Priority = --topInsert; + } else { + m_ModStatus[i].m_Priority = index++; + } // also, mark the mod-list as changed modStatusModified = true; } } + // to support insertion of new mods at the top we may now have mods with negative priority. shift them all up + // to align priority with 0 + if (topInsert < 0) { + int offset = topInsert * -1; + for (size_t i = 0; i < m_ModStatus.size(); ++i) { + ModInfo::Ptr modInfo = ModInfo::getByIndex(i); + if (modInfo->getFixedPriority() == INT_MAX) { + continue; + } + + m_ModStatus[i].m_Priority += offset; + } + } file.close(); updateIndices(); -- cgit v1.3.1