added condition for empty loader type
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
172680abf8
commit
c54fecf5d9
@ -133,7 +133,7 @@ auto FlameAPI::getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::Indexe
|
|||||||
for (auto file : arr) {
|
for (auto file : arr) {
|
||||||
auto file_obj = Json::requireObject(file);
|
auto file_obj = Json::requireObject(file);
|
||||||
auto file_tmp = FlameMod::loadIndexedPackVersion(file_obj);
|
auto file_tmp = FlameMod::loadIndexedPackVersion(file_obj);
|
||||||
if (file_tmp.date > ver.date && (!args.loaders.has_value() || args.loaders.value() & file_tmp.loaders))
|
if (file_tmp.date > ver.date && (!args.loaders.has_value() || !file_tmp.loaders || args.loaders.value() & file_tmp.loaders))
|
||||||
ver = file_tmp;
|
ver = file_tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
|
|||||||
file.addonId = pack.addonId;
|
file.addonId = pack.addonId;
|
||||||
|
|
||||||
if (file.fileId.isValid() &&
|
if (file.fileId.isValid() &&
|
||||||
(!loaders.has_value() || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
(!loaders.has_value() || !file.loaders || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
||||||
unsortedVersions.append(file);
|
unsortedVersions.append(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ ModPlatform::IndexedVersion FlameMod::loadDependencyVersions(const ModPlatform::
|
|||||||
file.addonId = m.addonId;
|
file.addonId = m.addonId;
|
||||||
|
|
||||||
if (file.fileId.isValid() &&
|
if (file.fileId.isValid() &&
|
||||||
(!loaders.has_value() || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
(!loaders.has_value() || !file.loaders || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
||||||
versions.append(file);
|
versions.append(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack, QJsonArra
|
|||||||
auto file = loadIndexedPackVersion(obj);
|
auto file = loadIndexedPackVersion(obj);
|
||||||
|
|
||||||
if (file.fileId.isValid() &&
|
if (file.fileId.isValid() &&
|
||||||
(!loaders.has_value() || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
(!loaders.has_value() || !file.loaders || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
||||||
unsortedVersions.append(file);
|
unsortedVersions.append(file);
|
||||||
}
|
}
|
||||||
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
|
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
|
||||||
@ -242,7 +242,7 @@ auto Modrinth::loadDependencyVersions([[maybe_unused]] const ModPlatform::Depend
|
|||||||
auto file = loadIndexedPackVersion(obj);
|
auto file = loadIndexedPackVersion(obj);
|
||||||
|
|
||||||
if (file.fileId.isValid() &&
|
if (file.fileId.isValid() &&
|
||||||
(!loaders.has_value() || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
(!loaders.has_value() || !file.loaders || loaders.value() & file.loaders)) // Heuristic to check if the returned value is valid
|
||||||
versions.append(file);
|
versions.append(file);
|
||||||
}
|
}
|
||||||
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
|
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
|
||||||
|
@ -70,7 +70,8 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver,
|
|||||||
QString mineVer,
|
QString mineVer,
|
||||||
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
|
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
|
||||||
{
|
{
|
||||||
return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty() && (!loaders.has_value() || loaders.value() & ver.loaders);
|
return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty() &&
|
||||||
|
(!loaders.has_value() || !ver.loaders || loaders.value() & ver.loaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const
|
bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const
|
||||||
|
@ -67,7 +67,7 @@ auto ModrinthModPage::validateVersion(ModPlatform::IndexedVersion& ver,
|
|||||||
QString mineVer,
|
QString mineVer,
|
||||||
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
|
std::optional<ModPlatform::ModLoaderTypes> loaders) const -> bool
|
||||||
{
|
{
|
||||||
return ver.mcVersion.contains(mineVer) && (!loaders.has_value() || loaders.value() & ver.loaders);
|
return ver.mcVersion.contains(mineVer) && (!loaders.has_value() || !ver.loaders || loaders.value() & ver.loaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModrinthResourcePackPage::ModrinthResourcePackPage(ResourcePackDownloadDialog* dialog, BaseInstance& instance)
|
ModrinthResourcePackPage::ModrinthResourcePackPage(ResourcePackDownloadDialog* dialog, BaseInstance& instance)
|
||||||
|
Loading…
Reference in New Issue
Block a user