summaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-06-08 15:10:08 +0200
committerTannin <devnull@localhost>2014-06-08 15:10:08 +0200
commit0feb4b702d8a9eb1465c79c49ada5de01b67083d (patch)
tree378bba0b46c750f02f3f953e9f4076462a2633bf /src/profile.cpp
parent5a4b6e70fd815c9052ff71a4244bdeb707e92ba1 (diff)
- 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
Diffstat (limited to 'src/profile.cpp')
-rw-r--r--src/profile.cpp21
1 files changed, 20 insertions, 1 deletions
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<size_t>(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();