From 20cb97a35af5097e9d3b2062c0dfcb5f2e5fff5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 6 Sep 2014 18:16:56 +0200 Subject: Sync from quickmods --- logic/InstanceFactory.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'logic/InstanceFactory.cpp') diff --git a/logic/InstanceFactory.cpp b/logic/InstanceFactory.cpp index f0f7ffb3..e1cc64df 100644 --- a/logic/InstanceFactory.cpp +++ b/logic/InstanceFactory.cpp @@ -52,19 +52,19 @@ InstanceFactory::InstLoadError InstanceFactory::loadInstance(InstancePtr &inst, // FIXME: replace with a map lookup, where instance classes register their types if (inst_type == "OneSix" || inst_type == "Nostalgia") { - inst.reset(new OneSixInstance(instDir, m_settings, this)); + inst.reset(new OneSixInstance(instDir, m_settings)); } else if (inst_type == "Legacy") { - inst.reset(new LegacyInstance(instDir, m_settings, this)); + inst.reset(new LegacyInstance(instDir, m_settings)); } else if (inst_type == "LegacyFTB") { - inst.reset(new LegacyFTBInstance(instDir, m_settings, this)); + inst.reset(new LegacyFTBInstance(instDir, m_settings)); } else if (inst_type == "OneSixFTB") { - inst.reset(new OneSixFTBInstance(instDir, m_settings, this)); + inst.reset(new OneSixFTBInstance(instDir, m_settings)); } else { @@ -82,11 +82,15 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance(InstancePtr &in QLOG_DEBUG() << instDir.toUtf8(); if (!rootDir.exists() && !rootDir.mkpath(".")) { + QLOG_ERROR() << "Can't create instance folder" << instDir; return InstanceFactory::CantCreateDir; } auto mcVer = std::dynamic_pointer_cast(version); if (!mcVer) + { + QLOG_ERROR() << "Can't create instance for non-existing MC version"; return InstanceFactory::NoSuchVersion; + } auto m_settings = new INISettingsObject(PathCombine(instDir, "instance.cfg")); m_settings->registerSetting("InstanceType", "Legacy"); @@ -94,7 +98,7 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance(InstancePtr &in if (type == NormalInst) { m_settings->set("InstanceType", "OneSix"); - inst.reset(new OneSixInstance(instDir, m_settings, this)); + inst.reset(new OneSixInstance(instDir, m_settings)); inst->setIntendedVersionId(version->descriptor()); inst->setShouldUseCustomBaseJar(false); } @@ -103,14 +107,14 @@ InstanceFactory::InstCreateError InstanceFactory::createInstance(InstancePtr &in if(mcVer->usesLegacyLauncher()) { m_settings->set("InstanceType", "LegacyFTB"); - inst.reset(new LegacyFTBInstance(instDir, m_settings, this)); + inst.reset(new LegacyFTBInstance(instDir, m_settings)); inst->setIntendedVersionId(version->descriptor()); inst->setShouldUseCustomBaseJar(false); } else { m_settings->set("InstanceType", "OneSixFTB"); - inst.reset(new OneSixFTBInstance(instDir, m_settings, this)); + inst.reset(new OneSixFTBInstance(instDir, m_settings)); inst->setIntendedVersionId(version->descriptor()); inst->setShouldUseCustomBaseJar(false); } -- cgit v1.2.3