MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / collectTreeLinked

Method collectTreeLinked

launcher/minecraft/ComponentUpdateTask.cpp:422–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422ComponentContainer ComponentUpdateTask::collectTreeLinked(const QString& uid)
423{
424 ComponentContainer linked;
425
426 auto& components = d->m_profile->d->components;
427 auto& componentIndex = d->m_profile->d->componentIndex;
428 auto& instance = d->m_profile->d->m_instance;
429 for (auto comp : components) {
430 qCDebug(instanceProfileResolveC) << instance->name() << "|"
431 << "scanning" << comp->getID() << ":" << comp->getVersion() << "for tree link";
432 auto dep = std::find_if(comp->m_cachedRequires.cbegin(), comp->m_cachedRequires.cend(),
433 [uid](const Meta::Require& req) -> bool { return req.uid == uid; });
434 if (dep != comp->m_cachedRequires.cend()) {
435 qCDebug(instanceProfileResolveC) << instance->name() << "|" << comp->getID() << ":" << comp->getVersion() << "depends on"
436 << uid;
437 linked.append(comp);
438 }
439 }
440 auto iter = componentIndex.find(uid);
441 if (iter != componentIndex.end()) {
442 ComponentPtr comp = *iter;
443 comp->updateCachedData();
444 qCDebug(instanceProfileResolveC) << instance->name() << "|" << comp->getID() << ":" << comp->getVersion() << "has"
445 << comp->m_cachedRequires.size() << "dependencies";
446 for (auto dep : comp->m_cachedRequires) {
447 qCDebug(instanceProfileC) << instance->name() << "|" << uid << "depends on" << dep.uid;
448 auto found = componentIndex.find(dep.uid);
449 if (found != componentIndex.end()) {
450 qCDebug(instanceProfileC) << instance->name() << "|" << (*found)->getID() << "is present";
451 linked.append(*found);
452 }
453 }
454 }
455 return linked;
456}
457
458// FIXME, TODO: decouple dependency resolution from loading
459// FIXME: This works directly with the PackProfile internals. It shouldn't! It needs richer data types than PackProfile uses.

Callers

nothing calls this directly

Calls 7

getIDMethod · 0.80
appendMethod · 0.80
updateCachedDataMethod · 0.80
nameMethod · 0.45
getVersionMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected