summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Bessent <lost.dragonist@gmail.com>2020-01-26 18:26:03 -0700
committerChris Bessent <lost.dragonist@gmail.com>2020-01-26 18:26:03 -0700
commit4963c278fe849562b1059fe70f95b0cd74a48f70 (patch)
tree94dbb39dab382deb7d2212cca76a1801ba2bb03e /src
parent6214cf392395c6861f53e43f1bcf0cb4242f61de (diff)
Don't allow foreign mods or overwrite for overriding overwrite
Diffstat (limited to 'src')
-rw-r--r--src/editexecutablesdialog.cpp6
-rw-r--r--src/modinfo.cpp16
-rw-r--r--src/modinfo.h7
3 files changed, 28 insertions, 1 deletions
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 1c804a7c..52615c23 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -73,7 +73,11 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, int sel, QWidget
loadForcedLibraries();
for (auto&& m : m_organizerCore.modList()->allMods()) {
- if (ModInfo::isRegularName(m)) {
+ auto mod = ModInfo::getByName(m);
+ if (!mod->hasAnyOfTheseFlags({ ModInfo::FLAG_FOREIGN,
+ ModInfo::FLAG_BACKUP,
+ ModInfo::FLAG_OVERWRITE,
+ ModInfo::FLAG_SEPARATOR })) {
ui->mods->addItem(m);
}
}
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index 6e048bfb..d971f150 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -491,6 +491,22 @@ bool ModInfo::hasFlag(ModInfo::EFlag flag) const
return std::find(flags.begin(), flags.end(), flag) != flags.end();
}
+bool ModInfo::hasAnyOfTheseFlags(std::vector<ModInfo::EFlag> flags) const
+{
+ std::vector<EFlag> modFlags = getFlags();
+ for (auto modFlag : modFlags)
+ {
+ for (auto flag : flags)
+ {
+ if (modFlag == flag)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
bool ModInfo::hasContent(ModInfo::EContent content) const
{
std::vector<EContent> contents = getContents();
diff --git a/src/modinfo.h b/src/modinfo.h
index a27822b0..34b1ecdf 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -542,6 +542,13 @@ public:
bool hasFlag(EFlag flag) const;
/**
+ * @brief test if any of the provided flags are set for this mod
+ * @param flags the flags to test
+ * @return true if any of the flags are set, false otherwise
+ */
+ bool hasAnyOfTheseFlags(std::vector<ModInfo::EFlag> flags) const;
+
+ /**
* @brief test if the mods contains the specified content
* @param content the content to test
* @return true if the content is there, false otherwise