diff options
Diffstat (limited to 'logic/minecraft')
-rw-r--r-- | logic/minecraft/MinecraftProfile.cpp | 8 | ||||
-rw-r--r-- | logic/minecraft/MinecraftProfile.h | 10 | ||||
-rw-r--r-- | logic/minecraft/OneSixLibrary.cpp | 42 | ||||
-rw-r--r-- | logic/minecraft/OneSixLibrary.h | 50 | ||||
-rw-r--r-- | logic/minecraft/OneSixUpdate.cpp | 4 | ||||
-rw-r--r-- | logic/minecraft/RawLibrary.h | 26 | ||||
-rw-r--r-- | logic/minecraft/VersionFile.cpp | 12 | ||||
-rw-r--r-- | logic/minecraft/VersionFile.h | 2 |
8 files changed, 42 insertions, 112 deletions
diff --git a/logic/minecraft/MinecraftProfile.cpp b/logic/minecraft/MinecraftProfile.cpp index 360fa575..379705a7 100644 --- a/logic/minecraft/MinecraftProfile.cpp +++ b/logic/minecraft/MinecraftProfile.cpp @@ -233,9 +233,9 @@ bool MinecraftProfile::revertToVanilla() return true; } -QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs() +QList<std::shared_ptr<RawLibrary> > MinecraftProfile::getActiveNormalLibs() { - QList<std::shared_ptr<OneSixLibrary> > output; + QList<std::shared_ptr<RawLibrary> > output; for (auto lib : libraries) { if (lib->isActive() && !lib->isNative()) @@ -254,9 +254,9 @@ QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNormalLibs() return output; } -QList<std::shared_ptr<OneSixLibrary> > MinecraftProfile::getActiveNativeLibs() +QList<std::shared_ptr<RawLibrary> > MinecraftProfile::getActiveNativeLibs() { - QList<std::shared_ptr<OneSixLibrary> > output; + QList<std::shared_ptr<RawLibrary> > output; for (auto lib : libraries) { if (lib->isActive() && lib->isNative()) diff --git a/logic/minecraft/MinecraftProfile.h b/logic/minecraft/MinecraftProfile.h index 7686c55b..a9b3c299 100644 --- a/logic/minecraft/MinecraftProfile.h +++ b/logic/minecraft/MinecraftProfile.h @@ -21,7 +21,7 @@ #include <QList> #include <memory> -#include "OneSixLibrary.h" +#include "RawLibrary.h" #include "VersionFile.h" #include "JarMod.h" @@ -96,10 +96,10 @@ public: public: /// get all java libraries that belong to the classpath - QList<std::shared_ptr<OneSixLibrary>> getActiveNormalLibs(); + QList<RawLibraryPtr> getActiveNormalLibs(); /// get all native libraries that need to be available to the process - QList<std::shared_ptr<OneSixLibrary>> getActiveNativeLibs(); + QList<RawLibraryPtr> getActiveNativeLibs(); /// get file ID of the patch file at # QString versionFileId(const int index) const; @@ -171,10 +171,10 @@ public: /* data */ QString appletClass; /// the list of libs - both active and inactive, native and java - QList<OneSixLibraryPtr> libraries; + QList<RawLibraryPtr> libraries; /// same, but only vanilla. - QList<OneSixLibraryPtr> vanillaLibraries; + QList<RawLibraryPtr> vanillaLibraries; /// traits, collected from all the version files (version files can only add) QSet<QString> traits; diff --git a/logic/minecraft/OneSixLibrary.cpp b/logic/minecraft/OneSixLibrary.cpp deleted file mode 100644 index fe94d817..00000000 --- a/logic/minecraft/OneSixLibrary.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <QJsonArray> - -#include "OneSixLibrary.h" -#include "OneSixRule.h" -#include "OpSys.h" - -OneSixLibrary::OneSixLibrary(RawLibraryPtr base) -{ - m_name = base->m_name; - m_base_url = base->m_base_url; - m_hint = base->m_hint; - m_absolute_url = base->m_absolute_url; - extract_excludes = base->extract_excludes; - m_native_classifiers = base->m_native_classifiers; - m_rules = base->m_rules; - m_storagePrefix = base->m_storagePrefix; - // these only make sense for raw libraries. OneSix - /* - insertType = base->insertType; - insertData = base->insertData; - */ -} - -OneSixLibraryPtr OneSixLibrary::fromRawLibrary(RawLibraryPtr lib) -{ - return OneSixLibraryPtr(new OneSixLibrary(lib)); -} diff --git a/logic/minecraft/OneSixLibrary.h b/logic/minecraft/OneSixLibrary.h deleted file mode 100644 index e0ca52a8..00000000 --- a/logic/minecraft/OneSixLibrary.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <QString> -#include <QStringList> -#include <QMap> -#include <QJsonObject> -#include <QDir> -#include <memory> - -#include "net/URLConstants.h" -#include "minecraft/OpSys.h" -#include "minecraft/RawLibrary.h" - -class OneSixLibrary; -typedef std::shared_ptr<OneSixLibrary> OneSixLibraryPtr; - -/** - * This is a leftover from a previous design. - * All it does is separate the 'Raw' libraries read from files from the 'OneSix' libraries - * used for actually doing things. - * - * DEPRECATED, but still useful to keep the data clean and separated by type. - */ -class OneSixLibrary : public RawLibrary -{ -public: - /// Constructor - OneSixLibrary(const QString &name) - { - m_name = name; - } - /// Constructor - OneSixLibrary(RawLibraryPtr base); - static OneSixLibraryPtr fromRawLibrary(RawLibraryPtr lib); -}; diff --git a/logic/minecraft/OneSixUpdate.cpp b/logic/minecraft/OneSixUpdate.cpp index 75a16824..5babb0b6 100644 --- a/logic/minecraft/OneSixUpdate.cpp +++ b/logic/minecraft/OneSixUpdate.cpp @@ -27,7 +27,7 @@ #include "BaseInstance.h" #include "minecraft/MinecraftVersionList.h" #include "minecraft/MinecraftProfile.h" -#include "minecraft/OneSixLibrary.h" +#include "minecraft/RawLibrary.h" #include "minecraft/OneSixInstance.h" #include "forge/ForgeMirrors.h" #include "net/URLConstants.h" @@ -213,7 +213,7 @@ void OneSixUpdate::jarlibStart() auto metacache = ENV.metacache(); QList<ForgeXzDownloadPtr> ForgeLibs; - QList<std::shared_ptr<OneSixLibrary>> brokenLocalLibs; + QList<RawLibraryPtr> brokenLocalLibs; for (auto lib : libs) { diff --git a/logic/minecraft/RawLibrary.h b/logic/minecraft/RawLibrary.h index efe51bc0..7f0aed2f 100644 --- a/logic/minecraft/RawLibrary.h +++ b/logic/minecraft/RawLibrary.h @@ -18,14 +18,36 @@ typedef std::shared_ptr<RawLibrary> RawLibraryPtr; class RawLibrary { - friend class OneSixLibrary; -public: /* methods */ +public: + RawLibrary() + { + } + RawLibrary(const QString &name) + { + m_name = name; + } + /// limited copy without some data. TODO: why? + static RawLibraryPtr limitedCopy(RawLibraryPtr base) + { + auto newlib = std::make_shared<RawLibrary>(); + newlib->m_name = base->m_name; + newlib->m_base_url = base->m_base_url; + newlib->m_hint = base->m_hint; + newlib->m_absolute_url = base->m_absolute_url; + newlib->extract_excludes = base->extract_excludes; + newlib->m_native_classifiers = base->m_native_classifiers; + newlib->m_rules = base->m_rules; + newlib->m_storagePrefix = base->m_storagePrefix; + return newlib; + } + /// read and create a basic library static RawLibraryPtr fromJson(const QJsonObject &libObj, const QString &filename); /// Convert the library back to an JSON object QJsonObject toJson() const; +public: /* methods */ /// Returns the raw name field const GradleSpecifier & rawName() const { diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp index 2bc08d20..e0b4aa85 100644 --- a/logic/minecraft/VersionFile.cpp +++ b/logic/minecraft/VersionFile.cpp @@ -4,7 +4,7 @@ #include <QDebug> #include "minecraft/VersionFile.h" -#include "minecraft/OneSixLibrary.h" +#include "minecraft/RawLibrary.h" #include "minecraft/MinecraftProfile.h" #include "minecraft/JarMod.h" #include "ParseUtils.h" @@ -32,7 +32,7 @@ static QString readStringRet(const QJsonObject &root, const QString &key) return QString(); } -int findLibraryByName(QList<OneSixLibraryPtr> haystack, const GradleSpecifier &needle) +int findLibraryByName(QList<RawLibraryPtr> haystack, const GradleSpecifier &needle) { int retval = -1; for (int i = 0; i < haystack.size(); ++i) @@ -379,10 +379,10 @@ void VersionFile::applyTo(MinecraftProfile *version) version->traits.unite(traits); if (shouldOverwriteLibs) { - QList<OneSixLibraryPtr> libs; + QList<RawLibraryPtr> libs; for (auto lib : overwriteLibs) { - libs.append(OneSixLibrary::fromRawLibrary(lib)); + libs.append(RawLibrary::limitedCopy(lib)); } if (isMinecraftVersion()) { @@ -397,14 +397,14 @@ void VersionFile::applyTo(MinecraftProfile *version) // library not found? just add it. if (index < 0) { - version->libraries.append(OneSixLibrary::fromRawLibrary(addedLibrary)); + version->libraries.append(RawLibrary::limitedCopy(addedLibrary)); continue; } auto existingLibrary = version->libraries.at(index); // if we are higher it means we should update if (Version(addedLibrary->version()) > Version(existingLibrary->version())) { - auto library = OneSixLibrary::fromRawLibrary(addedLibrary); + auto library = RawLibrary::limitedCopy(addedLibrary); version->libraries.replace(index, library); } } diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h index ab94348b..56877936 100644 --- a/logic/minecraft/VersionFile.h +++ b/logic/minecraft/VersionFile.h @@ -9,7 +9,7 @@ #include "minecraft/OpSys.h" #include "minecraft/OneSixRule.h" #include "ProfilePatch.h" -#include "OneSixLibrary.h" +#include "RawLibrary.h" #include "JarMod.h" class MinecraftProfile; |