From 1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 21 Feb 2016 01:44:27 +0100 Subject: GH-1453 report version file problems in the version page --- logic/minecraft/VersionFile.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'logic/minecraft/VersionFile.cpp') diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index 50f4c289..fee83900 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -15,8 +15,6 @@ using namespace Json; #include "VersionBuildError.h" #include -#define CURRENT_MINIMUM_LAUNCHER_VERSION 18 - static void readString(const QJsonObject &root, const QString &key, QString &variable) { if (root.contains(key)) @@ -50,6 +48,19 @@ int findLibraryByName(QList haystack, const GradleSpecifier &n return retval; } +void checkMinimumLauncherVersion(VersionFilePtr out) +{ + const int CURRENT_MINIMUM_LAUNCHER_VERSION = 14; + if (out->minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION) + { + out->addProblem( + PROBLEM_WARNING, + QObject::tr("The 'minimumLauncherVersion' value of this version (%1) is higher than supported by MultiMC (%2). It might not work properly!") + .arg(out->minimumLauncherVersion) + .arg(CURRENT_MINIMUM_LAUNCHER_VERSION)); + } +} + VersionFilePtr VersionFile::fromMojangJson(const QJsonDocument &doc, const QString &filename) { VersionFilePtr out(new VersionFile()); @@ -82,6 +93,7 @@ VersionFilePtr VersionFile::fromMojangJson(const QJsonDocument &doc, const QStri if (root.contains("minimumLauncherVersion")) { out->minimumLauncherVersion = requireInteger(root.value("minimumLauncherVersion")); + checkMinimumLauncherVersion(out); } if (root.contains("libraries")) @@ -149,6 +161,7 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi if (root.contains("minimumLauncherVersion")) { out->minimumLauncherVersion = requireInteger(root.value("minimumLauncherVersion")); + checkMinimumLauncherVersion(out); } if (root.contains("tweakers")) @@ -304,15 +317,6 @@ bool VersionFile::hasJarMods() void VersionFile::applyTo(MinecraftProfile *version) { - if (minimumLauncherVersion != -1) - { - if (minimumLauncherVersion > CURRENT_MINIMUM_LAUNCHER_VERSION) - { - throw LauncherVersionError(minimumLauncherVersion, - CURRENT_MINIMUM_LAUNCHER_VERSION); - } - } - if (!version->id.isNull() && !mcVersion.isNull()) { if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(version->id) == -- cgit v1.2.3