summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2013-11-01 14:59:25 +0100
committerTannin <devnull@localhost>2013-11-01 14:59:25 +0100
commitd1594798e6e78bb329e744a72e92d3f292f38a20 (patch)
treedc3b8c822559655ab717841b1e22bd4c65dfff6e /src/modlist.cpp
parent09bd3dbead9afd6a57684908e77aba6960ad464d (diff)
- added a new diagnosis to detect potential problems in regards to esp vs. asset ordering (not fully functional yet)
- new plugin interfaces to the mod list - plugins can now query the origin (mod) of a esp/esm - bugfix: potential access to profile before one was activated - bugfix: regression in previous (not-yet-released) commit prevented changes to bsa list from being saved
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 0fdcf6fa..541e1e6e 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -551,6 +551,46 @@ void ModList::changeModPriority(int sourceIndex, int newPriority)
emit modorder_changed();
}
+IModList::ModState ModList::state(const QString &name) const
+{
+ unsigned int modIndex = ModInfo::getIndex(name);
+ if (modIndex == UINT_MAX) {
+ return IModList::STATE_MISSING;
+ } else {
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(modIndex);
+ if (modInfo->canBeEnabled()) {
+ return m_Profile->modEnabled(modIndex) ? IModList::STATE_ACTIVE : IModList::STATE_INACTIVE;
+ } else {
+ return IModList::STATE_NOTOPTIONAL;
+ }
+ }
+}
+
+int ModList::priority(const QString &name) const
+{
+ unsigned int modIndex = ModInfo::getIndex(name);
+ if (modIndex == UINT_MAX) {
+ return -1;
+ } else {
+ return m_Profile->getModPriority(modIndex);
+ }
+}
+
+bool ModList::setPriority(const QString &name, int newPriority)
+{
+ if ((newPriority < 0) || (newPriority >= static_cast<int>(m_Profile->numRegularMods()))) {
+ return false;
+ }
+
+ unsigned int modIndex = ModInfo::getIndex(name);
+ if (modIndex == UINT_MAX) {
+ return false;
+ } else {
+ m_Profile->setModPriority(modIndex, newPriority);
+ notifyChange(modIndex);
+ return true;
+ }
+}
bool ModList::dropURLs(const QMimeData *mimeData, int row, const QModelIndex &parent)
{