diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-03-13 20:57:01 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-03-26 17:05:27 +0100 |
commit | fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6 (patch) | |
tree | ffff93a5ac0de669293d695c446ae2051c74cb4f /logic/minecraft/onesix | |
parent | 010e07eb4552d805ad3dc08347531d9bad6b3c24 (diff) | |
download | MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.gz MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.lz MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.xz MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.zip |
NOISSUE stop referring to the minecraft profile as 'version'
Diffstat (limited to 'logic/minecraft/onesix')
-rw-r--r-- | logic/minecraft/onesix/OneSixInstance.cpp | 46 | ||||
-rw-r--r-- | logic/minecraft/onesix/OneSixInstance.h | 2 | ||||
-rw-r--r-- | logic/minecraft/onesix/OneSixUpdate.cpp | 24 |
3 files changed, 37 insertions, 35 deletions
diff --git a/logic/minecraft/onesix/OneSixInstance.cpp b/logic/minecraft/onesix/OneSixInstance.cpp index c64d527f..3e83ff1c 100644 --- a/logic/minecraft/onesix/OneSixInstance.cpp +++ b/logic/minecraft/onesix/OneSixInstance.cpp @@ -50,7 +50,7 @@ void OneSixInstance::init() void OneSixInstance::createProfile() { - m_version.reset(new MinecraftProfile(new OneSixProfileStrategy(this))); + m_profile.reset(new MinecraftProfile(new OneSixProfileStrategy(this))); } QSet<QString> OneSixInstance::traits() @@ -61,7 +61,9 @@ QSet<QString> OneSixInstance::traits() return {"version-incomplete"}; } else + { return version->getTraits(); + } } std::shared_ptr<Task> OneSixInstance::createUpdateTask() @@ -95,8 +97,8 @@ QString replaceTokensIn(QString text, QMap<QString, QString> with) QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) { - QString args_pattern = m_version->getMinecraftArguments(); - for (auto tweaker : m_version->getTweakers()) + QString args_pattern = m_profile->getMinecraftArguments(); + for (auto tweaker : m_profile->getTweakers()) { args_pattern += " --tweakClass " + tweaker; } @@ -111,9 +113,9 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) // blatant self-promotion. token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5"; - if(m_version->isVanilla()) + if(m_profile->isVanilla()) { - token_mapping["version_type"] = m_version->getMinecraftVersionType(); + token_mapping["version_type"] = m_profile->getMinecraftVersionType(); } else { @@ -123,14 +125,14 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) QString absRootDir = QDir(minecraftRoot()).absolutePath(); token_mapping["game_directory"] = absRootDir; QString absAssetsDir = QDir("assets/").absolutePath(); - token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_version->getMinecraftAssets()).absolutePath(); + token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_profile->getMinecraftAssets()).absolutePath(); token_mapping["user_properties"] = session->serializeUserProperties(); token_mapping["user_type"] = session->user_type; // 1.7.3+ assets tokens token_mapping["assets_root"] = absAssetsDir; - token_mapping["assets_index_name"] = m_version->getMinecraftAssets(); + token_mapping["assets_index_name"] = m_profile->getMinecraftAssets(); QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts); for (int i = 0; i < parts.length(); i++) @@ -147,7 +149,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) auto pixmap = icon.pixmap(128, 128); pixmap.save(FS::PathCombine(minecraftRoot(), "icon.png"), "PNG"); - if (!m_version) + if (!m_profile) return nullptr; for(auto & mod: loaderModList()->allMods()) @@ -172,14 +174,14 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";; } - for(auto & jarmod: m_version->getJarMods()) + for(auto & jarmod: m_profile->getJarMods()) { launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n"; } // libraries and class path. { - auto libs = m_version->getLibraries(); + auto libs = m_profile->getLibraries(); for (auto lib : libs) { launchScript += "cp " + QFileInfo(lib->storagePath()).absoluteFilePath() + "\n"; @@ -191,16 +193,16 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) } else { - QString relpath = m_version->getMinecraftVersion() + "/" + m_version->getMinecraftVersion() + ".jar"; + QString relpath = m_profile->getMinecraftVersion() + "/" + m_profile->getMinecraftVersion() + ".jar"; launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n"; } } - auto mainClass = m_version->getMainClass(); + auto mainClass = m_profile->getMainClass(); if (!mainClass.isEmpty()) { launchScript += "mainClass " + mainClass + "\n"; } - auto appletClass = m_version->getAppletClass(); + auto appletClass = m_profile->getAppletClass(); if (!appletClass.isEmpty()) { launchScript += "appletClass " + appletClass + "\n"; @@ -234,7 +236,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) // native libraries (mostly LWJGL) { QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/")); - for (auto native : m_version->getNativeLibraries()) + for (auto native : m_profile->getNativeLibraries()) { QFileInfo finfo(native->storagePath()); launchScript += "ext " + finfo.absoluteFilePath() + "\n"; @@ -243,7 +245,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) } // traits. including legacyLaunch and others ;) - for (auto trait : m_version->getTraits()) + for (auto trait : m_profile->getTraits()) { launchScript += "traits " + trait + "\n"; } @@ -313,9 +315,9 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask() } virtual void executeTask() { - std::shared_ptr<MinecraftProfile> version = m_inst->getMinecraftProfile(); + auto profile = m_inst->getMinecraftProfile(); // nuke obsolete stripped jar(s) if needed - QString version_id = version->getMinecraftVersion(); + QString version_id = profile->getMinecraftVersion(); QString strippedPath = version_id + "/" + version_id + "-stripped.jar"; QFile strippedJar(strippedPath); if(strippedJar.exists()) @@ -431,7 +433,7 @@ bool OneSixInstance::setIntendedVersionId(QString version) QList< Mod > OneSixInstance::getJarMods() const { QList<Mod> mods; - for (auto jarmod : m_version->getJarMods()) + for (auto jarmod : m_profile->getJarMods()) { QString filePath = jarmodsPath().absoluteFilePath(jarmod->name); mods.push_back(Mod(QFileInfo(filePath))); @@ -463,7 +465,7 @@ void OneSixInstance::reloadProfile() { try { - m_version->reload(); + m_profile->reload(); unsetFlag(VersionBrokenFlag); emit versionReloaded(); } @@ -472,7 +474,7 @@ void OneSixInstance::reloadProfile() } catch (Exception &error) { - m_version->clear(); + m_profile->clear(); setFlag(VersionBrokenFlag); // TODO: rethrow to show some error message(s)? emit versionReloaded(); @@ -482,13 +484,13 @@ void OneSixInstance::reloadProfile() void OneSixInstance::clearProfile() { - m_version->clear(); + m_profile->clear(); emit versionReloaded(); } std::shared_ptr<MinecraftProfile> OneSixInstance::getMinecraftProfile() const { - return m_version; + return m_profile; } QDir OneSixInstance::librariesPath() const diff --git a/logic/minecraft/onesix/OneSixInstance.h b/logic/minecraft/onesix/OneSixInstance.h index 09150158..0a92ab2f 100644 --- a/logic/minecraft/onesix/OneSixInstance.h +++ b/logic/minecraft/onesix/OneSixInstance.h @@ -101,7 +101,7 @@ private: QStringList processMinecraftArgs(AuthSessionPtr account); protected: - std::shared_ptr<MinecraftProfile> m_version; + std::shared_ptr<MinecraftProfile> m_profile; mutable std::shared_ptr<ModList> m_loader_mod_list; mutable std::shared_ptr<ModList> m_core_mod_list; mutable std::shared_ptr<ModList> m_resource_pack_list; diff --git a/logic/minecraft/onesix/OneSixUpdate.cpp b/logic/minecraft/onesix/OneSixUpdate.cpp index 78938a4f..814cde18 100644 --- a/logic/minecraft/onesix/OneSixUpdate.cpp +++ b/logic/minecraft/onesix/OneSixUpdate.cpp @@ -87,8 +87,8 @@ void OneSixUpdate::assetIndexStart() { setStatus(tr("Updating assets index...")); OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); - QString assetName = version->getMinecraftAssets(); + auto profile = inst->getMinecraftProfile(); + QString assetName = profile->getMinecraftAssets(); QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json"; QString localPath = assetName + ".json"; auto job = new NetJob(tr("Asset index for %1").arg(inst->name())); @@ -113,8 +113,8 @@ void OneSixUpdate::assetIndexFinished() qDebug() << m_inst->name() << ": Finished asset index download"; OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); - QString assetName = version->getMinecraftAssets(); + auto profile = inst->getMinecraftProfile(); + QString assetName = profile->getMinecraftAssets(); QString asset_fname = "assets/indexes/" + assetName + ".json"; if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index)) @@ -190,10 +190,10 @@ void OneSixUpdate::jarlibStart() } // Build a list of URLs that will need to be downloaded. - std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); + std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile(); // minecraft.jar for this version { - QString version_id = version->getMinecraftVersion(); + QString version_id = profile->getMinecraftVersion(); QString localPath = version_id + "/" + version_id + ".jar"; QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath; @@ -207,8 +207,8 @@ void OneSixUpdate::jarlibStart() jarlibDownloadJob.reset(job); } - auto libs = version->getNativeLibraries(); - libs.append(version->getLibraries()); + auto libs = profile->getNativeLibraries(); + libs.append(profile->getLibraries()); auto metacache = ENV.metacache(); QList<ForgeXzDownloadPtr> ForgeLibs; @@ -289,9 +289,9 @@ void OneSixUpdate::jarlibStart() void OneSixUpdate::jarlibFinished() { OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); + std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile(); - if (version->hasTrait("legacyFML")) + if (profile->hasTrait("legacyFML")) { fmllibsStart(); } @@ -313,7 +313,7 @@ void OneSixUpdate::fmllibsStart() { // Get the mod list OneSixInstance *inst = (OneSixInstance *)m_inst; - std::shared_ptr<MinecraftProfile> fullversion = inst->getMinecraftProfile(); + std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile(); bool forge_present = false; QString version = inst->intendedVersionId(); @@ -328,7 +328,7 @@ void OneSixUpdate::fmllibsStart() // determine if we need some libs for FML or forge setStatus(tr("Checking for FML libraries...")); - forge_present = (fullversion->versionPatch("net.minecraftforge") != nullptr); + forge_present = (profile->versionPatch("net.minecraftforge") != nullptr); // we don't... if (!forge_present) { |