Merge pull request #201 from Scrumplex/fix-instancetype-reregistration

This commit is contained in:
Sefa Eyeoglu 2022-02-26 14:37:27 +01:00 committed by GitHub
commit 88fc1e32ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -543,19 +543,8 @@ InstancePtr InstanceList::loadInstance(const InstanceId& id)
auto instanceRoot = FS::PathCombine(m_instDir, id); auto instanceRoot = FS::PathCombine(m_instDir, id);
auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg")); auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg"));
InstancePtr inst; InstancePtr inst;
// TODO: Handle incompatible instances
instanceSettings->registerSetting("InstanceType", "Legacy"); // intentionally Legacy. We don't support it. inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
QString inst_type = instanceSettings->get("InstanceType").toString();
if (inst_type == "OneSix" || inst_type == "Nostalgia")
{
inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
}
else
{
inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot));
}
qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot();
return inst; return inst;
} }