From a4f6298111b9b4518d00e6df3a53dd176858dd34 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 22 Jun 2024 01:31:26 -0500 Subject: 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 --- src/modinfowithconflictinfo.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/modinfowithconflictinfo.cpp') 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 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()); -- cgit v1.3.1