diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-03-27 03:34:39 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-04-07 00:20:02 +0200 |
commit | 5fabb4f2546fa6b79a4e2c29679f506e587a0070 (patch) | |
tree | fabccd987452ce98a6b80cad96a5d19c2d24be46 /api/logic/minecraft/onesix/OneSixVersionFormat.cpp | |
parent | 6f2a87167a13101d80d2fbc096bbb6a5eb5ab0c9 (diff) | |
download | MultiMC-5fabb4f2546fa6b79a4e2c29679f506e587a0070.tar MultiMC-5fabb4f2546fa6b79a4e2c29679f506e587a0070.tar.gz MultiMC-5fabb4f2546fa6b79a4e2c29679f506e587a0070.tar.lz MultiMC-5fabb4f2546fa6b79a4e2c29679f506e587a0070.tar.xz MultiMC-5fabb4f2546fa6b79a4e2c29679f506e587a0070.zip |
NOISSUE Rough refactor of ProfilePatch and VersionFile internals.
They are now distinct classes with distinct responsibilities.
* ProfilePatch is an entry in MinecraftProfile and can hold VersionFile or Meta::Version.
* VersionFile is the basic element that holds version information loaded from JSON.
* Meta::Version is the loader class for VersionFile(s) from a server.
Diffstat (limited to 'api/logic/minecraft/onesix/OneSixVersionFormat.cpp')
-rw-r--r-- | api/logic/minecraft/onesix/OneSixVersionFormat.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/api/logic/minecraft/onesix/OneSixVersionFormat.cpp b/api/logic/minecraft/onesix/OneSixVersionFormat.cpp index 944e68a4..266bd4bd 100644 --- a/api/logic/minecraft/onesix/OneSixVersionFormat.cpp +++ b/api/logic/minecraft/onesix/OneSixVersionFormat.cpp @@ -51,7 +51,7 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc { if (root.contains("order")) { - out->setOrder(requireInteger(root.value("order"))); + out->order = requireInteger(root.value("order")); } else { @@ -73,7 +73,7 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc out->version = root.value("version").toString(); out->dependsOnMinecraftVersion = root.value("mcVersion").toString(); - out->filename = filename; + // out->filename = filename; MojangVersionFormat::readVersionProperties(root, out.get()); @@ -128,7 +128,8 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc bool hasLibs = root.contains("libraries"); if (hasPlusLibs && hasLibs) { - out->addProblem(PROBLEM_WARNING, QObject::tr("Version file has both '+libraries' and 'libraries'. This is no longer supported.")); + out->addProblem(ProblemSeverity::Warning, + QObject::tr("Version file has both '+libraries' and 'libraries'. This is no longer supported.")); readLibs("libraries"); readLibs("+libraries"); } @@ -144,23 +145,23 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc /* removed features that shouldn't be used */ if (root.contains("tweakers")) { - out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element 'tweakers'")); + out->addProblem(ProblemSeverity::Error, QObject::tr("Version file contains unsupported element 'tweakers'")); } if (root.contains("-libraries")) { - out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '-libraries'")); + out->addProblem(ProblemSeverity::Error, QObject::tr("Version file contains unsupported element '-libraries'")); } if (root.contains("-tweakers")) { - out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '-tweakers'")); + out->addProblem(ProblemSeverity::Error, QObject::tr("Version file contains unsupported element '-tweakers'")); } if (root.contains("-minecraftArguments")) { - out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '-minecraftArguments'")); + out->addProblem(ProblemSeverity::Error, QObject::tr("Version file contains unsupported element '-minecraftArguments'")); } if (root.contains("+minecraftArguments")) { - out->addProblem(PROBLEM_ERROR, QObject::tr("Version file contains unsupported element '+minecraftArguments'")); + out->addProblem(ProblemSeverity::Error, QObject::tr("Version file contains unsupported element '+minecraftArguments'")); } return out; } @@ -170,7 +171,7 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch QJsonObject root; if (saveOrder) { - root.insert("order", patch->getOrder()); + root.insert("order", patch->order); } writeString(root, "name", patch->name); |