| 1182 | } |
| 1183 | |
| 1184 | void Profile::debugDump() const |
| 1185 | { |
| 1186 | struct Pair |
| 1187 | { |
| 1188 | std::size_t enabled = 0; |
| 1189 | std::size_t total = 0; |
| 1190 | }; |
| 1191 | |
| 1192 | Pair total; |
| 1193 | Pair real; |
| 1194 | Pair backup; |
| 1195 | Pair separators; |
| 1196 | Pair dlc; |
| 1197 | Pair cc; |
| 1198 | Pair unmanaged; |
| 1199 | |
| 1200 | auto add = [](Pair& p, const ModStatus& status) { |
| 1201 | ++p.total; |
| 1202 | |
| 1203 | if (status.m_Enabled) { |
| 1204 | ++p.enabled; |
| 1205 | } |
| 1206 | }; |
| 1207 | |
| 1208 | for (const auto& status : m_ModStatus) { |
| 1209 | auto index = m_ModIndexByPriority.find(status.m_Priority); |
| 1210 | if (index == m_ModIndexByPriority.end()) { |
| 1211 | log::error("mod with priority {} not in priority map", status.m_Priority); |
| 1212 | continue; |
| 1213 | } |
| 1214 | |
| 1215 | auto m = ModInfo::getByIndex(index->second); |
| 1216 | if (!m) { |
| 1217 | log::error("mod index {} with priority {} not found", index->second, |
| 1218 | status.m_Priority); |
| 1219 | continue; |
| 1220 | } |
| 1221 | |
| 1222 | if (m->hasFlag(ModInfo::FLAG_OVERWRITE)) { |
| 1223 | continue; |
| 1224 | } |
| 1225 | |
| 1226 | add(total, status); |
| 1227 | |
| 1228 | if (m->hasFlag(ModInfo::FLAG_BACKUP)) { |
| 1229 | add(backup, status); |
| 1230 | } |
| 1231 | |
| 1232 | if (m->hasFlag(ModInfo::FLAG_SEPARATOR)) { |
| 1233 | add(separators, status); |
| 1234 | } |
| 1235 | |
| 1236 | if (m->hasFlag(ModInfo::FLAG_FOREIGN)) { |
| 1237 | if (auto* f = dynamic_cast<ModInfoForeign*>(m.get())) { |
| 1238 | switch (f->modType()) { |
| 1239 | case ModInfo::MOD_DLC: |
| 1240 | add(dlc, status); |
| 1241 | break; |
no test coverage detected