summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/directoryrefresher.cpp3
-rw-r--r--src/modinfowithconflictinfo.cpp3
-rw-r--r--src/profile.cpp15
3 files changed, 7 insertions, 14 deletions
diff --git a/src/directoryrefresher.cpp b/src/directoryrefresher.cpp
index 8b6c55e3..3ce4691b 100644
--- a/src/directoryrefresher.cpp
+++ b/src/directoryrefresher.cpp
@@ -178,10 +178,9 @@ void DirectoryRefresher::refresh()
std::wstring dataDirectory = QDir::toNativeSeparators(game->dataDirectory().absolutePath()).toStdWString();
m_DirectoryStructure->addFromOrigin(L"data", dataDirectory, 0);
- // TODO what was the point of having the priority in this tuple? the list is already sorted by priority
+ std::sort(m_Mods.begin(), m_Mods.end(), [](auto lhs, auto rhs){return lhs.priority < rhs.priority;});
auto iter = m_Mods.begin();
- //TODO i is the priority here, where higher = more important. the input vector is also sorted by priority but inverted!
for (int i = 1; iter != m_Mods.end(); ++iter, ++i) {
try {
addModToStructure(m_DirectoryStructure, iter->modName, i, iter->absolutePath, iter->stealFiles, iter->archives);
diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp
index 12cbf416..744f323c 100644
--- a/src/modinfowithconflictinfo.cpp
+++ b/src/modinfowithconflictinfo.cpp
@@ -126,7 +126,8 @@ void ModInfoWithConflictInfo::doConflictCheck() const
for (auto altInfo : alternatives) {
if ((altInfo.first != dataID) && (altInfo.first != origin.getID())) {
FilesOrigin &altOrigin = (*m_DirectoryStructure)->getOriginByID(altInfo.first);
- unsigned int altIndex = ModInfo::getIndex(ToQString(altOrigin.getName()));
+ QString altOriginName = ToQString(altOrigin.getName());
+ unsigned int altIndex = ModInfo::getIndex(altOriginName);
if (altInfo.second.first.size() == 0) {
if (archiveData.first.size() == 0) {
if (origin.getPriority() > altOrigin.getPriority()) {
diff --git a/src/profile.cpp b/src/profile.cpp
index 79f7d59e..259f93c8 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -521,20 +521,13 @@ std::vector<std::tuple<QString, QString, int> > Profile::getActiveMods()
for (std::map<int, unsigned int>::const_iterator iter = m_ModIndexByPriority.begin(); iter != m_ModIndexByPriority.end(); iter++ ) {
if ((iter->second != UINT_MAX) && m_ModStatus[iter->second].m_Enabled) {
ModInfo::Ptr modInfo = ModInfo::getByIndex(iter->second);
- result.push_back(std::make_tuple(modInfo->internalName(), modInfo->absolutePath(), m_ModStatus[iter->second].m_Priority));
+ if (modInfo->hasFlag(ModInfo::FLAG_OVERWRITE))
+ result.push_back(std::make_tuple(modInfo->internalName(), modInfo->absolutePath(), INT_MAX));
+ else
+ result.push_back(std::make_tuple(modInfo->internalName(), modInfo->absolutePath(), m_ModStatus[iter->second].m_Priority));
}
}
- unsigned int overwriteIndex = ModInfo::findMod([](ModInfo::Ptr mod) -> bool {
- std::vector<ModInfo::EFlag> flags = mod->getFlags();
- return std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end(); });
-
- if (overwriteIndex != UINT_MAX) {
- ModInfo::Ptr overwriteInfo = ModInfo::getByIndex(overwriteIndex);
- result.push_back(std::make_tuple(overwriteInfo->name(), overwriteInfo->absolutePath(), UINT_MAX));
- } else {
- reportError(tr("Overwrite directory couldn't be parsed"));
- }
return result;
}