summaryrefslogtreecommitdiff
path: root/src/modinfowithconflictinfo.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2024-06-22 01:31:26 -0500
committerGitHub <noreply@github.com>2024-06-22 08:31:26 +0200
commita4f6298111b9b4518d00e6df3a53dd176858dd34 (patch)
tree11d35c88a96c6998eac9b7debb8736ebe907d014 /src/modinfowithconflictinfo.cpp
parentd3b647ab2b19626b2f86b5c2af3946c1fcf22068 (diff)
Parse unmanaged file location when creating ModInfoForeign (#2053)
* Parse unmanaged file location when creating ModInfoForeign - Fixes issues with secondaryDataDirectories * Revert SF memory address changes - CCC implementation prevents the need to determine core plugin LO by dependency chains * The light flag wins over the medium flag - I had expected the opposite, but apparently the light flag still wins if both are set. This shouldn't really happen but it's possible, even with the CK * Update display to account for multi-flagged plugins - Show both icons, warn if both set
Diffstat (limited to 'src/modinfowithconflictinfo.cpp')
-rw-r--r--src/modinfowithconflictinfo.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp
index 2300405a..df2dc7ce 100644
--- a/src/modinfowithconflictinfo.cpp
+++ b/src/modinfowithconflictinfo.cpp
@@ -99,9 +99,15 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co
bool providesAnything = false;
bool hasHiddenFiles = false;
- int dataID = 0;
+ std::vector<int> dataIDs;
if (m_Core.directoryStructure()->originExists(L"data")) {
- dataID = m_Core.directoryStructure()->getOriginByName(L"data").getID();
+ dataIDs.push_back(m_Core.directoryStructure()->getOriginByName(L"data").getID());
+ }
+ for (const auto& origin : m_Core.managedGame()->secondaryDataDirectories().keys()) {
+ if (m_Core.directoryStructure()->originExists(origin.toStdWString())) {
+ dataIDs.push_back(
+ m_Core.directoryStructure()->getOriginByName(origin.toStdWString()).getID());
+ }
}
std::wstring name = ToWString(this->name());
@@ -145,7 +151,9 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co
}
auto alternatives = file->getAlternatives();
- if ((alternatives.size() == 0) || (alternatives.back().originID() == dataID)) {
+ if ((alternatives.size() == 0) ||
+ std::find(dataIDs.begin(), dataIDs.end(), alternatives.back().originID()) !=
+ dataIDs.end()) {
// no alternatives -> no conflict
providesAnything = true;
} else {
@@ -181,7 +189,8 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co
// Sort out the alternatives
for (const auto& altInfo : alternatives) {
- if ((altInfo.originID() != dataID) &&
+ if (!(std::find(dataIDs.begin(), dataIDs.end(),
+ alternatives.back().originID()) != dataIDs.end()) &&
(altInfo.originID() != origin.getID())) {
FilesOrigin& altOrigin =
m_Core.directoryStructure()->getOriginByID(altInfo.originID());