summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/VersionFile.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-02-21 01:44:27 +0100
committerPetr Mrázek <peterix@gmail.com>2016-02-21 01:44:27 +0100
commit1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae (patch)
tree2c2fbc7a74ea5035fdfd8752272e011852eb1b85 /logic/minecraft/VersionFile.cpp
parent495d320ce267cf6d7c7e4468dbc36d3536bcb401 (diff)
downloadMultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.gz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.lz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.tar.xz
MultiMC-1a0bbdd9acaf1c5edaad6d3f0790c1b02674c0ae.zip
GH-1453 report version file problems in the version page
Diffstat (limited to 'logic/minecraft/VersionFile.cpp')
-rw-r--r--logic/minecraft/VersionFile.cpp26
1 files changed, 15 insertions, 11 deletions
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 <Version.h>
-#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<OneSixLibraryPtr> 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) ==