aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FlameAPI.cpp4
-rw-r--r--launcher/modplatform/flame/FlameCheckUpdate.cpp2
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp8
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.cpp1
-rw-r--r--launcher/modplatform/flame/FlamePackIndex.h3
5 files changed, 8 insertions, 10 deletions
diff --git a/launcher/modplatform/flame/FlameAPI.cpp b/launcher/modplatform/flame/FlameAPI.cpp
index 0f26efef..ad3ab16a 100644
--- a/launcher/modplatform/flame/FlameAPI.cpp
+++ b/launcher/modplatform/flame/FlameAPI.cpp
@@ -144,9 +144,7 @@ auto FlameAPI::getLatestVersion(VersionSearchArgs&& args) -> ModPlatform::Indexe
for (auto file : arr) {
auto file_obj = Json::requireObject(file);
auto file_tmp = FlameMod::loadIndexedPackVersion(file_obj);
- bool better_release = true;
- if (file_tmp.verison_type.has_value() && ver_tmp.verison_type.has_value())
- better_release = file_tmp.verison_type.value() < ver_tmp.verison_type.value();
+ bool better_release = file_tmp.verison_type < ver_tmp.verison_type;
if(file_tmp.date > ver_tmp.date && better_release) {
ver_tmp = file_tmp;
latest_file_obj = file_obj;
diff --git a/launcher/modplatform/flame/FlameCheckUpdate.cpp b/launcher/modplatform/flame/FlameCheckUpdate.cpp
index 06a89502..1e8cc66d 100644
--- a/launcher/modplatform/flame/FlameCheckUpdate.cpp
+++ b/launcher/modplatform/flame/FlameCheckUpdate.cpp
@@ -173,7 +173,7 @@ void FlameCheckUpdate::executeTask()
}
auto download_task = makeShared<ResourceDownloadTask>(pack, latest_ver, m_mods_folder);
- m_updatable.emplace_back(pack.name, mod->metadata()->hash, old_version, latest_ver.version,
+ m_updatable.emplace_back(pack.name, mod->metadata()->hash, old_version, latest_ver.version, latest_ver.verison_type,
api.getModFileChangelog(latest_ver.addonId.toInt(), latest_ver.fileId.toInt()),
ModPlatform::ResourceProvider::FLAME, download_task);
}
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 5866cfbd..cb7177d2 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -94,9 +94,7 @@ void FlameMod::loadIndexedPackVersions(ModPlatform::IndexedPack& pack,
}
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;
};
@@ -126,9 +124,7 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
file.version = Json::requireString(obj, "displayName");
file.downloadUrl = Json::ensureString(obj, "downloadUrl");
file.fileName = Json::requireString(obj, "fileName");
- auto version_type = ModPlatform::IndexedVersionType(Json::requireInteger(obj, "releaseType"));
- if (version_type.isValid())
- file.verison_type = version_type;
+ file.verison_type = ModPlatform::IndexedVersionType(Json::requireInteger(obj, "releaseType"));
auto hash_list = Json::ensureArray(obj, "hashes");
for (auto h : hash_list) {
diff --git a/launcher/modplatform/flame/FlamePackIndex.cpp b/launcher/modplatform/flame/FlamePackIndex.cpp
index ad48b7b6..e643c96b 100644
--- a/launcher/modplatform/flame/FlamePackIndex.cpp
+++ b/launcher/modplatform/flame/FlamePackIndex.cpp
@@ -90,6 +90,7 @@ void Flame::loadIndexedPackVersions(Flame::IndexedPack& pack, QJsonArray& arr)
// pick the latest version supported
file.mcVersion = versionArray[0].toString();
file.version = Json::requireString(version, "displayName");
+ file.version_type = ModPlatform::IndexedVersionType(Json::requireInteger(version, "releaseType"));
file.downloadUrl = Json::ensureString(version, "downloadUrl");
// only add if we have a download URL (third party distribution is enabled)
diff --git a/launcher/modplatform/flame/FlamePackIndex.h b/launcher/modplatform/flame/FlamePackIndex.h
index 1ca0fc0e..0abcadb3 100644
--- a/launcher/modplatform/flame/FlamePackIndex.h
+++ b/launcher/modplatform/flame/FlamePackIndex.h
@@ -5,6 +5,8 @@
#include <QString>
#include <QVector>
+#include "modplatform/ModIndex.h"
+
namespace Flame {
struct ModpackAuthor {
@@ -16,6 +18,7 @@ struct IndexedVersion {
int addonId;
int fileId;
QString version;
+ ModPlatform::IndexedVersionType version_type;
QString mcVersion;
QString downloadUrl;
};