NOISSUE Move FTB logic out of generic code

This commit is contained in:
Petr Mrázek
2015-04-04 15:46:15 +02:00
parent c7b39fe116
commit 8b4e22bbb8
10 changed files with 400 additions and 316 deletions

View File

@@ -31,9 +31,6 @@
#include "logic/OneSixInstance.h"
#include "logic/BaseVersion.h"
#include "logic/minecraft/MinecraftVersion.h"
#include "logic/ftb/LegacyFTBInstance.h"
#include "logic/ftb/OneSixFTBInstance.h"
#include "logic/ftb/FTBVersion.h"
InstanceFactory InstanceFactory::loader;
@@ -59,14 +56,6 @@ InstanceFactory::InstLoadError InstanceFactory::loadInstance(InstancePtr &inst,
{
inst.reset(new LegacyInstance(instDir, m_settings));
}
else if (inst_type == "LegacyFTB")
{
inst.reset(new LegacyFTBInstance(instDir, m_settings));
}
else if (inst_type == "OneSixFTB")
{
inst.reset(new OneSixFTBInstance(instDir, m_settings));
}
else
{
return InstanceFactory::UnknownLoadError;
@@ -106,25 +95,6 @@ InstanceFactory::createInstance(InstancePtr &inst, BaseVersionPtr version, const
inst->init();
return InstanceFactory::NoCreateError;
}
auto ftbVersion = std::dynamic_pointer_cast<FTBVersion>(version);
if(ftbVersion)
{
auto mcversion = ftbVersion->getMinecraftVersion();
if (mcversion->usesLegacyLauncher())
{
m_settings->set("InstanceType", "LegacyFTB");
inst.reset(new LegacyFTBInstance(instDir, m_settings));
inst->setIntendedVersionId(mcversion->descriptor());
}
else
{
m_settings->set("InstanceType", "OneSixFTB");
inst.reset(new OneSixFTBInstance(instDir, m_settings));
inst->setIntendedVersionId(mcversion->descriptor());
inst->init();
}
return InstanceFactory::NoCreateError;
}
delete m_settings;
return InstanceFactory::NoSuchVersion;
}
@@ -146,11 +116,6 @@ InstanceFactory::InstCreateError InstanceFactory::copyInstance(InstancePtr &newI
settings_obj.registerSetting("InstanceType", "Legacy");
QString inst_type = settings_obj.get("InstanceType").toString();
if (inst_type == "OneSixFTB")
settings_obj.set("InstanceType", "OneSix");
if (inst_type == "LegacyFTB")
settings_obj.set("InstanceType", "Legacy");
oldInstance->copy(instDir);
auto error = loadInstance(newInstance, instDir);