From 3b0fbebc6ad8979d9d4551fcd9db1b8f2ca4bf48 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:06:41 -0400 Subject: dump a bunch of counts for mods when selecting a profile --- src/profile.cpp | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) (limited to 'src/profile.cpp') diff --git a/src/profile.cpp b/src/profile.cpp index 19c0d750..927e575c 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see . #include #include "util.h" #include "registry.h" +#include "modinfoforeign.h" #include #include @@ -1065,3 +1066,98 @@ void Profile::removeForcedLibraries(const QString &executable) { m_Settings->remove("forced_libraries/" + executable); } + +void Profile::debugDump() const +{ + struct Pair + { + std::size_t enabled=0; + std::size_t total=0; + }; + + Pair total; + Pair real; + Pair backup; + Pair separators; + Pair dlc; + Pair cc; + Pair unmanaged; + + auto add = [](Pair& p, const ModStatus& status) { + ++p.total; + + if (status.m_Enabled) { + ++p.enabled; + } + }; + + + for (const auto& status : m_ModStatus) { + if (status.m_Overwrite) { + continue; + } + + auto index = m_ModIndexByPriority.find(status.m_Priority); + if (index == m_ModIndexByPriority.end()) { + log::error("mod with priority {} not in priority map", status.m_Priority); + continue; + } + + auto m = ModInfo::getByIndex(index->second); + if (!m) { + log::error("mod index {} with priority {} not found", index->second, status.m_Priority); + continue; + } + + add(total, status); + + if (m->hasFlag(ModInfo::FLAG_BACKUP)) { + add(backup, status); + } + + if (m->hasFlag(ModInfo::FLAG_SEPARATOR)) { + add(separators, status); + } + + if (m->hasFlag(ModInfo::FLAG_FOREIGN)) { + if (auto* f = dynamic_cast(m.get())) { + switch (f->modType()) + { + case ModInfo::MOD_DLC: + add(dlc, status); + break; + + case ModInfo::MOD_CC: + add(cc, status); + break; + + default: + add(unmanaged, status); + break; + } + } + } + + if (!m->hasAnyOfTheseFlags({ + ModInfo::FLAG_BACKUP, ModInfo::FLAG_FOREIGN, + ModInfo::FLAG_SEPARATOR, ModInfo::FLAG_OVERWRITE })) + { + add(real, status); + } + } + + log::debug( + "profile '{}' in '{}': " + "mods={}/{} backup={}/{} separators={}/{} real={}/{} dlc={}/{} " + "cc={}/{} unmanaged={}/{} localsaves={}, localsettings={}", + name(), absolutePath(), + total.enabled, total.total, + backup.enabled, backup.total, + separators.enabled, separators.total, + real.enabled, real.total, + dlc.enabled, dlc.total, + cc.enabled, cc.total, + unmanaged.enabled, unmanaged.total, + localSavesEnabled() ? "yes" : "no", + localSettingsEnabled() ? "yes" : "no"); +} -- cgit v1.3.1