diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2022-04-14 21:55:03 +0200 |
---|---|---|
committer | Sefa Eyeoglu <contact@scrumplex.net> | 2022-04-14 21:55:03 +0200 |
commit | 9fb5674233c21775fac76cf96cd2a77c4098e908 (patch) | |
tree | 45cb7670e2231424e70619ee6a54da908fd1dbe1 /launcher/modplatform | |
parent | 18ac109e5abb86eebd254931efeea3630371a0bb (diff) | |
download | PrismLauncher-9fb5674233c21775fac76cf96cd2a77c4098e908.tar.gz PrismLauncher-9fb5674233c21775fac76cf96cd2a77c4098e908.tar.bz2 PrismLauncher-9fb5674233c21775fac76cf96cd2a77c4098e908.zip |
refactor: cleanup ModLoaderType
Diffstat (limited to 'launcher/modplatform')
-rw-r--r-- | launcher/modplatform/ModAPI.h | 20 | ||||
-rw-r--r-- | launcher/modplatform/modrinth/ModrinthAPI.h | 19 |
2 files changed, 24 insertions, 15 deletions
diff --git a/launcher/modplatform/ModAPI.h b/launcher/modplatform/ModAPI.h index 1e38cf62..1a562172 100644 --- a/launcher/modplatform/ModAPI.h +++ b/launcher/modplatform/ModAPI.h @@ -15,7 +15,7 @@ class ModAPI { virtual ~ModAPI() = default; // https://docs.curseforge.com/?http#tocS_ModLoaderType - enum ModLoaderType { Any = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4, Quilt = 5 }; + enum ModLoaderType { Unspecified = 0, Forge = 1, Cauldron = 2, LiteLoader = 3, Fabric = 4, Quilt = 5 }; struct SearchArgs { int offset; @@ -35,4 +35,22 @@ class ModAPI { }; virtual void getVersions(CallerType* caller, VersionSearchArgs&& args) const = 0; + + static auto getModLoaderString(ModLoaderType type) -> const QString { + switch (type) { + case Unspecified: + break; + case Forge: + return "forge"; + case Cauldron: + return "cauldron"; + case LiteLoader: + return "liteloader"; + case Fabric: + return "fabric"; + case Quilt: + return "quilt"; + } + return ""; + } }; diff --git a/launcher/modplatform/modrinth/ModrinthAPI.h b/launcher/modplatform/modrinth/ModrinthAPI.h index 711649d9..eefa4a85 100644 --- a/launcher/modplatform/modrinth/ModrinthAPI.h +++ b/launcher/modplatform/modrinth/ModrinthAPI.h @@ -51,25 +51,16 @@ class ModrinthAPI : public NetworkModAPI { return s; } - inline auto getModLoaderString(ModLoaderType modLoader) const -> QString + static auto getModLoaderString(ModLoaderType type) -> const QString { - switch (modLoader) { - case Any: - return "fabric, forge, quilt"; - case Forge: - return "forge"; - case Fabric: - return "fabric"; - case Quilt: - return "quilt"; - default: - return ""; - } + if (type == Unspecified) + return "fabric, forge, quilt"; + return ModAPI::getModLoaderString(type); } inline auto validateModLoader(ModLoaderType modLoader) const -> bool { - return modLoader == Any || modLoader == Forge || modLoader == Fabric || modLoader == Quilt; + return modLoader == Unspecified || modLoader == Forge || modLoader == Fabric || modLoader == Quilt; } }; |