From 1eb783aae348f906056cee17cb65dfd507429901 Mon Sep 17 00:00:00 2001 From: Tannin Date: Sat, 31 May 2014 13:43:48 +0200 Subject: - added a new mod type that represents files handled externally (i.e. DLCs) as mods in MO - hashes of file names in bsa files are no longer checked all the time - author and description is now read from esp files - rewrote the code that fixes modlists after a rename, should be a bit more robust - fixes to qt 5 and msvc 2013 compatibility - started to update the tutorial (not done yet!) - bugfix: counter for the problems badge wasn't calculated correctly --- src/profile.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index 8d02c047..2d982790 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -162,8 +162,11 @@ void Profile::writeModlistNow(bool onlyOnTimer) const unsigned int index = m_ModIndexByPriority[i]; if (index != UINT_MAX) { ModInfo::Ptr modInfo = ModInfo::getByIndex(index); - if (modInfo->getFixedPriority() == INT_MIN) { - if (m_ModStatus[index].m_Enabled) { + std::vector flags = modInfo->getFlags(); + if ((modInfo->getFixedPriority() == INT_MIN)) { + if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) != flags.end()) { + file->write("*"); + } else if (m_ModStatus[index].m_Enabled) { file->write("+"); } else { file->write("-"); @@ -255,7 +258,8 @@ void Profile::refreshModStatus() } else if (line.at(0) == '-') { enabled = false; modName = QString::fromUtf8(line.mid(1).trimmed().constData()); - } else if (line.at(0) == '+') { + } else if ((line.at(0) == '+') + || (line.at(0) == '*')) { modName = QString::fromUtf8(line.mid(1).trimmed().constData()); } else { modName = QString::fromUtf8(line.trimmed().constData()); @@ -269,8 +273,9 @@ void Profile::refreshModStatus() unsigned int modindex = ModInfo::getIndex(modName); if (modindex != UINT_MAX) { ModInfo::Ptr info = ModInfo::getByIndex(modindex); - if ((modindex < m_ModStatus.size()) && (info->getFixedPriority() == INT_MIN)) { - m_ModStatus[modindex].m_Enabled = enabled; + if ((modindex < m_ModStatus.size()) + && (info->getFixedPriority() == INT_MIN)) { + m_ModStatus[modindex].m_Enabled = enabled || info->alwaysEnabled(); if (m_ModStatus[modindex].m_Priority == -1) { if (static_cast(index) >= m_ModStatus.size()) { throw MyException(tr("invalid index %1").arg(index)); @@ -295,9 +300,10 @@ void Profile::refreshModStatus() // give priorities to mods not referenced in the profile for (size_t i = 0; i < m_ModStatus.size(); ++i) { ModInfo::Ptr modInfo = ModInfo::getByIndex(i); - if (!modInfo->canBeEnabled()) { + if (modInfo->getFixedPriority() == INT_MAX) { continue; } + if (m_ModStatus[i].m_Priority != -1) { m_ModStatus[i].m_Priority = numKnownMods - m_ModStatus[i].m_Priority - 1; } else { -- cgit v1.3.1