diff options
author | Jan Dalheimer <jan@dalheimer.de> | 2013-12-20 14:47:26 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-21 23:40:37 +0100 |
commit | 82c87aa06f793b9f38e6cb42d284f00695f4bac5 (patch) | |
tree | 21f893b0336a90d4e4b9f14cb5312f2c1ea04280 /logic/InstanceFactory.cpp | |
parent | 34a3fedf7b115c84ff305bf72fbc9d568682d84a (diff) | |
download | MultiMC-82c87aa06f793b9f38e6cb42d284f00695f4bac5.tar MultiMC-82c87aa06f793b9f38e6cb42d284f00695f4bac5.tar.gz MultiMC-82c87aa06f793b9f38e6cb42d284f00695f4bac5.tar.lz MultiMC-82c87aa06f793b9f38e6cb42d284f00695f4bac5.tar.xz MultiMC-82c87aa06f793b9f38e6cb42d284f00695f4bac5.zip |
Initial FTB support. Allows "tracking" of FTB instances.
Diffstat (limited to 'logic/InstanceFactory.cpp')
-rw-r--r-- | logic/InstanceFactory.cpp | 86 |
1 files changed, 64 insertions, 22 deletions
diff --git a/logic/InstanceFactory.cpp b/logic/InstanceFactory.cpp index 66b271d0..31a287dd 100644 --- a/logic/InstanceFactory.cpp +++ b/logic/InstanceFactory.cpp @@ -20,7 +20,9 @@ #include "BaseInstance.h" #include "LegacyInstance.h" +#include "LegacyFTBInstance.h" #include "OneSixInstance.h" +#include "OneSixFTBInstance.h" #include "NostalgiaInstance.h" #include "BaseVersion.h" #include "MinecraftVersion.h" @@ -60,6 +62,14 @@ InstanceFactory::InstLoadError InstanceFactory::loadInstance(BaseInstance *&inst { inst = new NostalgiaInstance(instDir, m_settings, this); } + else if (inst_type == "LegacyFTB") + { + inst = new LegacyFTBInstance(instDir, m_settings, this); + } + else if (inst_type == "OneSixFTB") + { + inst = new OneSixFTBInstance(instDir, m_settings, this); + } else { return InstanceFactory::UnknownLoadError; @@ -69,7 +79,8 @@ InstanceFactory::InstLoadError InstanceFactory::loadInstance(BaseInstance *&inst InstanceFactory::InstCreateError InstanceFactory::createInstance(BaseInstance *&inst, BaseVersionPtr version, - const QString &instDir) + const QString &instDir, + const InstType type) { QDir rootDir(instDir); @@ -85,32 +96,63 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance(BaseInstance *& auto m_settings = new INISettingsObject(PathCombine(instDir, "instance.cfg")); m_settings->registerSetting(new Setting("InstanceType", "Legacy")); - switch (mcVer->type) + if (type == NormalInst) { - case MinecraftVersion::Legacy: - m_settings->set("InstanceType", "Legacy"); - inst = new LegacyInstance(instDir, m_settings, this); - inst->setIntendedVersionId(version->descriptor()); - inst->setShouldUseCustomBaseJar(false); - break; - case MinecraftVersion::OneSix: - m_settings->set("InstanceType", "OneSix"); - inst = new OneSixInstance(instDir, m_settings, this); - inst->setIntendedVersionId(version->descriptor()); - inst->setShouldUseCustomBaseJar(false); - break; - case MinecraftVersion::Nostalgia: - m_settings->set("InstanceType", "Nostalgia"); - inst = new NostalgiaInstance(instDir, m_settings, this); - inst->setIntendedVersionId(version->descriptor()); - inst->setShouldUseCustomBaseJar(false); - break; - default: + switch (mcVer->type) + { + case MinecraftVersion::Legacy: + m_settings->set("InstanceType", "Legacy"); + inst = new LegacyInstance(instDir, m_settings, this); + inst->setIntendedVersionId(version->descriptor()); + inst->setShouldUseCustomBaseJar(false); + break; + case MinecraftVersion::OneSix: + m_settings->set("InstanceType", "OneSix"); + inst = new OneSixInstance(instDir, m_settings, this); + inst->setIntendedVersionId(version->descriptor()); + inst->setShouldUseCustomBaseJar(false); + break; + case MinecraftVersion::Nostalgia: + m_settings->set("InstanceType", "Nostalgia"); + inst = new NostalgiaInstance(instDir, m_settings, this); + inst->setIntendedVersionId(version->descriptor()); + inst->setShouldUseCustomBaseJar(false); + break; + default: + { + delete m_settings; + return InstanceFactory::NoSuchVersion; + } + } + } + else if (type == FTBInstance) + { + switch (mcVer->type) + { + case MinecraftVersion::Legacy: + m_settings->set("InstanceType", "LegacyFTB"); + inst = new LegacyFTBInstance(instDir, m_settings, this); + inst->setIntendedVersionId(version->descriptor()); + inst->setShouldUseCustomBaseJar(false); + break; + case MinecraftVersion::OneSix: + m_settings->set("InstanceType", "OneSixFTB"); + inst = new OneSixFTBInstance(instDir, m_settings, this); + inst->setIntendedVersionId(version->descriptor()); + inst->setShouldUseCustomBaseJar(false); + break; + default: + { + delete m_settings; + return InstanceFactory::NoSuchVersion; + } + } + } + else { delete m_settings; return InstanceFactory::NoSuchVersion; } - } // FIXME: really, how do you even know? return InstanceFactory::NoCreateError; |