summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-02-11 19:56:55 +0100
committerPetr Mrázek <peterix@gmail.com>2015-04-12 20:57:18 +0200
commit234f57b8e60fcae35bbfdf206655f4f438b99191 (patch)
tree8e0d74fa0cfca6bd2bb5870186ef6f865ee10108
parentd4d8cb48919eec22402c5ed88a48796b1ca5311b (diff)
downloadMultiMC-234f57b8e60fcae35bbfdf206655f4f438b99191.tar
MultiMC-234f57b8e60fcae35bbfdf206655f4f438b99191.tar.gz
MultiMC-234f57b8e60fcae35bbfdf206655f4f438b99191.tar.lz
MultiMC-234f57b8e60fcae35bbfdf206655f4f438b99191.tar.xz
MultiMC-234f57b8e60fcae35bbfdf206655f4f438b99191.zip
NOISSUE Add NullInstance for instances that can't be loaded
-rw-r--r--logic/CMakeLists.txt1
-rw-r--r--logic/InstanceList.cpp3
-rw-r--r--logic/NullInstance.h61
3 files changed, 64 insertions, 1 deletions
diff --git a/logic/CMakeLists.txt b/logic/CMakeLists.txt
index cf55695d..08a6f3a8 100644
--- a/logic/CMakeLists.txt
+++ b/logic/CMakeLists.txt
@@ -13,6 +13,7 @@ SET(LOGIC_SOURCES
BaseProcess.cpp
BaseInstance.h
BaseInstance.cpp
+ NullInstance.h
MMCError.h
# WARNING: globals live here
diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp
index 013de31e..a65d9f56 100644
--- a/logic/InstanceList.cpp
+++ b/logic/InstanceList.cpp
@@ -37,6 +37,7 @@
#include "minecraft/MinecraftVersion.h"
#include "settings/INISettingsObject.h"
#include "ftb/FTBPlugin.h"
+#include "NullInstance.h"
const static int GROUP_FILE_FORMAT_VERSION = 1;
@@ -454,7 +455,7 @@ InstanceList::loadInstance(InstancePtr &inst, const QString &instDir)
}
else
{
- return InstanceList::UnknownLoadError;
+ inst.reset(new NullInstance(m_globalSettings, instanceSettings, instDir));
}
inst->init();
return NoLoadError;
diff --git a/logic/NullInstance.h b/logic/NullInstance.h
new file mode 100644
index 00000000..cf8c7fce
--- /dev/null
+++ b/logic/NullInstance.h
@@ -0,0 +1,61 @@
+#include "BaseInstance.h"
+
+class NullInstance: public BaseInstance
+{
+public:
+ NullInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString& rootDir)
+ :BaseInstance(globalSettings, settings, rootDir)
+ {
+ setFlag(BaseInstance::VersionBrokenFlag);
+ }
+ virtual ~NullInstance() {};
+ virtual bool setIntendedVersionId(QString) override
+ {
+ return false;
+ }
+ virtual void cleanupAfterRun() override
+ {
+ }
+ virtual QString currentVersionId() const
+ {
+ return "Null";
+ };
+ virtual QString intendedVersionId() const
+ {
+ return "Null";
+ };
+ virtual void init() override
+ {
+ };
+ virtual QString getStatusbarDescription() override
+ {
+ return tr("Unknown instance type");
+ };
+ virtual bool shouldUpdate() const override
+ {
+ return false;
+ };
+ virtual QSet< QString > traits()
+ {
+ return {};
+ };
+ virtual QString instanceConfigFolder() const
+ {
+ return instanceRoot();
+ };
+ virtual BaseProcess* prepareForLaunch(AuthSessionPtr)
+ {
+ return nullptr;
+ }
+ virtual std::shared_ptr< Task > doUpdate()
+ {
+ return nullptr;
+ }
+ virtual void setShouldUpdate(bool)
+ {
+ };
+ virtual std::shared_ptr< BaseVersionList > versionList() const
+ {
+ return nullptr;
+ };
+};