allow making incompatibilities platform-specific

This commit is contained in:
HJfod 2024-09-09 22:29:34 +03:00
parent 62af8da879
commit 9f1c70ad09

View file

@ -228,6 +228,16 @@ Result<ModMetadata> ModMetadata::Impl::createFromSchemaV010(ModJson const& rawJs
} }
for (auto& incompat : root.has("incompatibilities").items()) { for (auto& incompat : root.has("incompatibilities").items()) {
bool onThisPlatform = !incompat.has("platforms");
for (auto& plat : incompat.has("platforms").items()) {
if (PlatformID::coveredBy(plat.get<std::string>(), GEODE_PLATFORM_TARGET)) {
onThisPlatform = true;
}
}
if (!onThisPlatform) {
continue;
}
Incompatibility incompatibility; Incompatibility incompatibility;
incompat.needs("id").mustBe<std::string>(ID_REGEX, &ModMetadata::Impl::validateOldID).into(incompatibility.id); incompat.needs("id").mustBe<std::string>(ID_REGEX, &ModMetadata::Impl::validateOldID).into(incompatibility.id);
incompat.needs("version").into(incompatibility.version); incompat.needs("version").into(incompatibility.version);