MCPcopy Create free account
hub / github.com/PrismLauncher/PrismLauncher / collectMods

Function collectMods

launcher/minecraft/mod/ModFolderModel.cpp:318–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318QSet<Mod*> collectMods(QSet<Mod*> mods, QHash<QString, QSet<Mod*>> relation, std::set<QString>& seen, bool shouldBeEnabled)
319{
320 QSet<Mod*> affectedList = {};
321 QSet<Mod*> needToCheck = {};
322 for (auto mod : mods) {
323 auto id = mod->mod_id();
324 if (seen.count(id) == 0) {
325 seen.insert(id);
326 for (auto affected : relation[id]) {
327 auto affectedId = affected->mod_id();
328
329 if (findById(mods, affectedId) == nullptr && seen.count(affectedId) == 0) {
330 seen.insert(affectedId);
331 if (shouldBeEnabled != affected->enabled()) {
332 affectedList << affected;
333 }
334 needToCheck << affected;
335 }
336 }
337 }
338 }
339 // collect the affected mods until all of them are included in the list
340 if (!needToCheck.isEmpty()) {
341 affectedList += collectMods(needToCheck, relation, seen, shouldBeEnabled);
342 }
343 return affectedList;
344}
345
346QModelIndexList ModFolderModel::getAffectedMods(const QModelIndexList& indexes, EnableAction action)
347{

Callers 2

getAffectedModsMethod · 0.85
setResourceEnabledMethod · 0.85

Calls 6

findByIdFunction · 0.85
insertMethod · 0.80
enabledMethod · 0.80
mod_idMethod · 0.45
countMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected