diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-08-03 15:57:33 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-08-03 15:57:33 +0200 |
commit | 13b1b98f7cf8a3b3b2c15dd42f96537b02c00711 (patch) | |
tree | ff3a67221e90eb9aa067e0b0d1f934fd4dd28534 /backend/InstanceFactory.cpp | |
parent | 2e0cbf393a5320dbf5448ca44a9b5905314b0be8 (diff) | |
download | MultiMC-13b1b98f7cf8a3b3b2c15dd42f96537b02c00711.tar MultiMC-13b1b98f7cf8a3b3b2c15dd42f96537b02c00711.tar.gz MultiMC-13b1b98f7cf8a3b3b2c15dd42f96537b02c00711.tar.lz MultiMC-13b1b98f7cf8a3b3b2c15dd42f96537b02c00711.tar.xz MultiMC-13b1b98f7cf8a3b3b2c15dd42f96537b02c00711.zip |
WTF, I don't even...
Diffstat (limited to 'backend/InstanceFactory.cpp')
-rw-r--r-- | backend/InstanceFactory.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/backend/InstanceFactory.cpp b/backend/InstanceFactory.cpp index 318650ae..ee582d3f 100644 --- a/backend/InstanceFactory.cpp +++ b/backend/InstanceFactory.cpp @@ -19,8 +19,12 @@ #include <QFileInfo> #include "BaseInstance.h" +#include "LegacyInstance.h" +#include "OneSixInstance.h" #include "inifile.h" +#include <inisettingsobject.h> +#include <setting.h> #include "pathutils.h" @@ -34,12 +38,25 @@ InstanceFactory::InstanceFactory() : InstanceFactory::InstLoadError InstanceFactory::loadInstance(BaseInstance *&inst, const QString &instDir) { - BaseInstance *loadedInst = new BaseInstance(instDir, this); + auto m_settings = new INISettingsObject(PathCombine(instDir, "instance.cfg")); - // TODO: Sanity checks to verify that the instance is valid. + m_settings->registerSetting(new Setting("InstanceType", "Legacy")); - inst = loadedInst; + QString inst_type = m_settings->get("InstanceType").toString(); + //FIXME: replace with a map lookup, where instance classes register their types + if(inst_type == "Legacy") + { + inst = new LegacyInstance(instDir, m_settings, this); + } + else if(inst_type == "OneSix") + { + inst = new OneSixInstance(instDir, m_settings, this); + } + else + { + return InstanceFactory::UnknownLoadError; + } return NoLoadError; } @@ -53,8 +70,8 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance(BaseInstance *& { return InstanceFactory::CantCreateDir; } - - inst = new BaseInstance(instDir, this); + return InstanceFactory::UnknownCreateError; + //inst = new BaseInstance(instDir, this); //FIXME: really, how do you even know? return InstanceFactory::NoCreateError; |