aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/modrinth')
-rw-r--r--launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp4
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackIndex.cpp8
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.cpp4
-rw-r--r--launcher/modplatform/modrinth/ModrinthPackManifest.h3
4 files changed, 10 insertions, 9 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
index d1be7209..76ad7015 100644
--- a/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
+++ b/launcher/modplatform/modrinth/ModrinthCheckUpdate.cpp
@@ -161,8 +161,8 @@ void ModrinthCheckUpdate::executeTask()
auto download_task = makeShared<ResourceDownloadTask>(pack, project_ver, m_mods_folder);
- m_updatable.emplace_back(pack.name, hash, mod->version(), project_ver.version_number, project_ver.changelog,
- ModPlatform::ResourceProvider::MODRINTH, download_task);
+ m_updatable.emplace_back(pack.name, hash, mod->version(), project_ver.version_number, project_ver.verison_type,
+ project_ver.changelog, ModPlatform::ResourceProvider::MODRINTH, download_task);
}
}
} catch (Json::JsonException& e) {
diff --git a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
index c87fa302..2e9d1457 100644
--- a/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackIndex.cpp
@@ -109,9 +109,7 @@ void Modrinth::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
unsortedVersions.append(file);
}
auto orderSortPredicate = [](const ModPlatform::IndexedVersion& a, const ModPlatform::IndexedVersion& b) -> bool {
- bool a_better_release = true;
- if (a.verison_type.has_value() && b.verison_type.has_value())
- a_better_release = a.verison_type.value() < b.verison_type.value();
+ bool a_better_release = a.verison_type < b.verison_type;
// dates are in RFC 3339 format
return a.date > b.date && a_better_release;
};
@@ -141,9 +139,7 @@ auto Modrinth::loadIndexedPackVersion(QJsonObject& obj, QString preferred_hash_t
}
file.version = Json::requireString(obj, "name");
file.version_number = Json::requireString(obj, "version_number");
- auto verison_type = ModPlatform::IndexedVersionType(Json::requireString(obj, "version_type"));
- if (verison_type.isValid())
- file.verison_type = verison_type;
+ file.verison_type = ModPlatform::IndexedVersionType(Json::requireString(obj, "version_type"));
file.changelog = Json::requireString(obj, "changelog");
diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
index 4dca786f..04ed4fa2 100644
--- a/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
+++ b/launcher/modplatform/modrinth/ModrinthPackManifest.cpp
@@ -111,8 +111,9 @@ void loadIndexedVersions(Modpack& pack, QJsonDocument& doc)
unsortedVersions.append(file);
}
auto orderSortPredicate = [](const ModpackVersion& a, const ModpackVersion& b) -> bool {
+ bool a_better_release = a.version_type < b.version_type;
// dates are in RFC 3339 format
- return a.date > b.date;
+ return a.date > b.date && a_better_release;
};
std::sort(unsortedVersions.begin(), unsortedVersions.end(), orderSortPredicate);
@@ -128,6 +129,7 @@ auto loadIndexedVersion(QJsonObject &obj) -> ModpackVersion
file.name = Json::requireString(obj, "name");
file.version = Json::requireString(obj, "version_number");
+ file.version_type = ModPlatform::IndexedVersionType(Json::requireString(obj, "version_type"));
file.changelog = Json::ensureString(obj, "changelog");
file.id = Json::requireString(obj, "id");
diff --git a/launcher/modplatform/modrinth/ModrinthPackManifest.h b/launcher/modplatform/modrinth/ModrinthPackManifest.h
index 2973dfba..5f8c50a1 100644
--- a/launcher/modplatform/modrinth/ModrinthPackManifest.h
+++ b/launcher/modplatform/modrinth/ModrinthPackManifest.h
@@ -45,6 +45,8 @@
#include <QUrl>
#include <QVector>
+#include "modplatform/ModIndex.h"
+
class MinecraftInstance;
namespace Modrinth {
@@ -80,6 +82,7 @@ struct ModpackExtra {
struct ModpackVersion {
QString name;
QString version;
+ ModPlatform::IndexedVersionType version_type;
QString changelog;
QString id;