summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-08-11 02:17:48 +0200
committerPetr Mrázek <peterix@gmail.com>2014-08-11 02:17:48 +0200
commit814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb (patch)
tree88d954f0c634794e2de4614652bf99c2ed1ec016
parentfd6706391b62294967e781c17de4ac85f665836d (diff)
downloadMultiMC-814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb.tar
MultiMC-814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb.tar.gz
MultiMC-814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb.tar.lz
MultiMC-814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb.tar.xz
MultiMC-814d5d3315ef82e9eeb7adcf71b1105c0b3afcdb.zip
Properly detect if the instance is vanilla and don't treat it as custom.
-rw-r--r--logic/minecraft/InstanceVersion.cpp7
-rw-r--r--logic/minecraft/MinecraftVersion.cpp6
-rw-r--r--logic/minecraft/MinecraftVersion.h1
-rw-r--r--logic/minecraft/VersionBuilder.cpp1
-rw-r--r--logic/minecraft/VersionFile.h9
-rw-r--r--logic/minecraft/VersionPatch.h1
6 files changed, 23 insertions, 2 deletions
diff --git a/logic/minecraft/InstanceVersion.cpp b/logic/minecraft/InstanceVersion.cpp
index addbcc84..c345e1fb 100644
--- a/logic/minecraft/InstanceVersion.cpp
+++ b/logic/minecraft/InstanceVersion.cpp
@@ -157,8 +157,11 @@ bool InstanceVersion::removeFtbPack()
bool InstanceVersion::isVanilla()
{
QDir patches(PathCombine(m_instance->instanceRoot(), "patches/"));
- if(VersionPatches.size() >= 1)
- return false;
+ for(auto patchptr: VersionPatches)
+ {
+ if(patchptr->isCustom())
+ return false;
+ }
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "custom.json")))
return false;
if(QFile::exists(PathCombine(m_instance->instanceRoot(), "version.json")))
diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp
index 8368c430..939c1149 100644
--- a/logic/minecraft/MinecraftVersion.cpp
+++ b/logic/minecraft/MinecraftVersion.cpp
@@ -155,3 +155,9 @@ bool MinecraftVersion::hasUpdate()
{
return m_versionSource == Remote || (m_versionSource == Local && upstreamUpdate);
}
+
+bool MinecraftVersion::isCustom()
+{
+ // if we add any other source types, this will evaluate to false for them.
+ return m_versionSource != Builtin && m_versionSource != Local && m_versionSource != Remote;
+}
diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h
index e06dadb1..152eeb8a 100644
--- a/logic/minecraft/MinecraftVersion.h
+++ b/logic/minecraft/MinecraftVersion.h
@@ -47,6 +47,7 @@ public: /* methods */
virtual QString getPatchFilename() override;
bool needsUpdate();
bool hasUpdate();
+ virtual bool isCustom();
private: /* methods */
void applyFileTo(InstanceVersion *version);
diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp
index fea0c8d1..dbaf5257 100644
--- a/logic/minecraft/VersionBuilder.cpp
+++ b/logic/minecraft/VersionBuilder.cpp
@@ -199,6 +199,7 @@ void VersionBuilder::buildFromMultilayer()
throw VersionIncomplete("org.lwjgl");
}
lwjglPatch->setOrder(-1);
+ lwjgl->setVanilla(true);
m_version->VersionPatches.append(lwjglPatch);
// load all patches, put into map for ordering, apply in the right order
diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h
index 9a6c5d3c..96856891 100644
--- a/logic/minecraft/VersionFile.h
+++ b/logic/minecraft/VersionFile.h
@@ -53,9 +53,18 @@ public: /* methods */
{
return filename;
}
+ virtual bool isCustom()
+ {
+ return !isVanilla;
+ };
+ void setVanilla (bool state)
+ {
+ isVanilla = state;
+ }
public: /* data */
int order = 0;
+ bool isVanilla = false;
QString name;
QString fileId;
QString version;
diff --git a/logic/minecraft/VersionPatch.h b/logic/minecraft/VersionPatch.h
index 1dd30e79..6c7bd7cf 100644
--- a/logic/minecraft/VersionPatch.h
+++ b/logic/minecraft/VersionPatch.h
@@ -26,6 +26,7 @@ public:
virtual QString getPatchName() = 0;
virtual QString getPatchVersion() = 0;
virtual QString getPatchFilename() = 0;
+ virtual bool isCustom() = 0;
};
typedef std::shared_ptr<VersionPatch> VersionPatchPtr;