aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-04-17 00:49:35 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-04-21 18:42:05 +0300
commit7bd26ce4687b498fb91d42594da07fea1eca5552 (patch)
tree69e7514378593e08ba5bb65123d6783ecc262c9d /launcher/minecraft/mod
parentbcea19b957bb0db4270b7573540af40143cca7de (diff)
downloadPrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.tar.gz
PrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.tar.bz2
PrismLauncher-7bd26ce4687b498fb91d42594da07fea1eca5552.zip
Semi fixed the Modrinth dependency implementation
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r--launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
index aeaa4b5b..92e652c0 100644
--- a/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
+++ b/launcher/minecraft/mod/tasks/GetModDependenciesTask.cpp
@@ -69,7 +69,8 @@ void GetModDependenciesTask::prepareDependecies()
return;
}
for (auto dep : c_dependencies) {
- auto task = m_getDependenciesVersionAPI(dep, [this](ModPlatform::IndexedVersion new_version) { addDependecies(new_version, 20); });
+ auto task =
+ m_getDependenciesVersionAPI(dep, [this](const ModPlatform::IndexedVersion& new_version) { addDependecies(new_version, 20); });
m_getNetworkDep->addTask(task);
}
m_getNetworkDep->start();
@@ -89,7 +90,7 @@ void GetModDependenciesTask::addDependecies(const ModPlatform::IndexedVersion& n
}
for (auto dep : c_dependencies) {
auto task = m_getDependenciesVersionAPI(
- dep, [this, level](ModPlatform::IndexedVersion new_versions) { addDependecies(new_versions, level - 1); });
+ dep, [this, level](const ModPlatform::IndexedVersion& new_versions) { addDependecies(new_versions, level - 1); });
m_getNetworkDep->addTask(task);
}
};
@@ -101,13 +102,13 @@ QList<ModPlatform::Dependency> GetModDependenciesTask::getDependenciesForVersion
for (auto ver_dep : version.dependencies) {
if (ver_dep.type == ModPlatform::DependencyType::REQUIRED) {
if (auto dep = std::find_if(c_dependencies.begin(), c_dependencies.end(),
- [&ver_dep](auto i) { return i.addonId == ver_dep.addonId; });
+ [&ver_dep](const auto& i) { return i.addonId == ver_dep.addonId; });
dep == c_dependencies.end()) { // check the current dependency list
- if (auto dep =
- std::find_if(selected.begin(), selected.end(), [&ver_dep](auto i) { return i.addonId == ver_dep.addonId; });
+ if (auto dep = std::find_if(selected.begin(), selected.end(),
+ [&ver_dep](const auto& i) { return i.addonId == ver_dep.addonId; });
dep == selected.end()) { // check the selected versions
- if (auto dep =
- std::find_if(m_mods.begin(), m_mods.end(), [&ver_dep](auto i) { return i.mod_id() == ver_dep.addonId; });
+ if (auto dep = std::find_if(m_mods.begin(), m_mods.end(),
+ [&ver_dep](const auto& i) { return i.project_id == ver_dep.addonId; });
dep == m_mods.end()) { // check the existing mods
c_dependencies.append(ver_dep);
}
@@ -124,10 +125,11 @@ QList<ModPlatform::Dependency> GetModDependenciesTask::getDependenciesForVersion
auto c_dependencies = QList<ModPlatform::Dependency>();
for (auto ver_dep : version.dependencies) {
if (ver_dep.type == ModPlatform::DependencyType::REQUIRED) {
- if (auto dep =
- std::find_if(c_dependencies.begin(), c_dependencies.end(), [&ver_dep](auto i) { return i.addonId == ver_dep.addonId; });
+ if (auto dep = std::find_if(c_dependencies.begin(), c_dependencies.end(),
+ [&ver_dep](const auto& i) { return i.addonId == ver_dep.addonId; });
dep == c_dependencies.end()) { // check the current dependency list
- if (auto dep = std::find_if(m_mods.begin(), m_mods.end(), [&ver_dep](auto i) { return i.mod_id() == ver_dep.addonId; });
+ if (auto dep =
+ std::find_if(m_mods.begin(), m_mods.end(), [&ver_dep](const auto& i) { return i.project_id == ver_dep.addonId; });
dep == m_mods.end()) { // check the existing mods
c_dependencies.append(ver_dep);
}