summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modinfo.h6
-rw-r--r--src/modinfobackup.h1
-rw-r--r--src/profile.cpp9
3 files changed, 12 insertions, 4 deletions
diff --git a/src/modinfo.h b/src/modinfo.h
index 0fbcd1c0..ff6c4001 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -606,10 +606,10 @@ public: // Methods after this do not come from IModInterface:
//
bool isFixedPriority() const { return isBackup() || isOverwrite(); }
- /**
- * @return true if the mod is always enabled.
- */
+ // check if this mod should always be enabled or disabled
+ //
virtual bool alwaysEnabled() const { return false; }
+ virtual bool alwaysDisabled() const { return false; }
/**
* @return true if the mod can be updated.
diff --git a/src/modinfobackup.h b/src/modinfobackup.h
index 9529855b..853a1211 100644
--- a/src/modinfobackup.h
+++ b/src/modinfobackup.h
@@ -20,6 +20,7 @@ public:
virtual void setNexusID(int) override {}
virtual void endorse(bool) override {}
virtual void ignoreUpdate(bool) override {}
+ virtual bool alwaysDisabled() const override { return true; }
virtual bool canBeUpdated() const override { return false; }
virtual QDateTime getExpires() const override { return QDateTime(); }
virtual bool canBeEnabled() const override { return false; }
diff --git a/src/profile.cpp b/src/profile.cpp
index 6b8d0709..66c23ea1 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -602,11 +602,15 @@ void Profile::setModEnabled(unsigned int index, bool enabled)
}
ModInfo::Ptr modInfo = ModInfo::getByIndex(index);
+
// we could quit in the following case, this shouldn't be a change anyway,
// but at least this allows the situation to be fixed in case of an error
if (modInfo->alwaysEnabled()) {
enabled = true;
}
+ if (modInfo->alwaysDisabled()) {
+ enabled = false;
+ }
if (enabled != m_ModStatus[index].m_Enabled) {
m_ModStatus[index].m_Enabled = enabled;
@@ -614,7 +618,7 @@ void Profile::setModEnabled(unsigned int index, bool enabled)
}
}
-void Profile::setModsEnabled(const QList<unsigned int> &modsToEnable, const QList<unsigned int> &modsToDisable)
+void Profile::setModsEnabled(const QList<unsigned int>& modsToEnable, const QList<unsigned int>& modsToDisable)
{
QList<unsigned int> dirtyMods;
for (auto idx : modsToEnable) {
@@ -622,6 +626,9 @@ void Profile::setModsEnabled(const QList<unsigned int> &modsToEnable, const QLis
log::error("invalid mod index: {}", idx);
continue;
}
+ if (ModInfo::getByIndex(idx)->alwaysDisabled()) {
+ continue;
+ }
if (!m_ModStatus[idx].m_Enabled) {
m_ModStatus[idx].m_Enabled = true;
dirtyMods.append(idx);