Mod checks against sellable, missing or multiple Palace(s) (#9516)

* Mod checks against sellable, missing or multiple Palace(s)

* Fix Studio adding quotes unasked
This commit is contained in:
SomeTroglodyte 2023-06-05 18:04:27 +02:00 committed by GitHub
parent e036d27935
commit 2d02e69d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,8 +62,10 @@ class RulesetValidator(val ruleset: Ruleset) {
UniqueType.Unbuildable)) UniqueType.Unbuildable))
lines += "${building.name} is buildable and therefore must either have an explicit cost or reference an existing tech!" lines += "${building.name} is buildable and therefore must either have an explicit cost or reference an existing tech!"
checkUniques(building, lines, rulesetInvariant, tryFixUnknownUniques) if (building.hasUnique(UniqueType.IndicatesCapital) && !building.isAnyWonder() && !building.hasUnique(UniqueType.Unsellable))
lines += "${building.name} is a Capital indicator and therefore must either be a wonder or explicitly marked 'Unsellable'!"
checkUniques(building, lines, rulesetInvariant, tryFixUnknownUniques)
} }
for (nation in ruleset.nations.values) { for (nation in ruleset.nations.values) {
@ -181,6 +183,12 @@ class RulesetValidator(val ruleset: Ruleset) {
checkUniques(unit, lines, rulesetSpecific, tryFixUnknownUniques) checkUniques(unit, lines, rulesetSpecific, tryFixUnknownUniques)
} }
when (ruleset.buildings.values.count { it.hasUnique(UniqueType.IndicatesCapital) }) {
0 -> lines += "No building indicating the Capital in ruleset!"
1 -> Unit
else -> lines.add("There is more than one building indicating the Capital in the ruleset!", RulesetErrorSeverity.Warning)
}
for (building in ruleset.buildings.values) { for (building in ruleset.buildings.values) {
if (building.requiredTech != null && !ruleset.technologies.containsKey(building.requiredTech!!)) if (building.requiredTech != null && !ruleset.technologies.containsKey(building.requiredTech!!))
lines += "${building.name} requires tech ${building.requiredTech} which does not exist!" lines += "${building.name} requires tech ${building.requiredTech} which does not exist!"
@ -336,7 +344,7 @@ class RulesetValidator(val ruleset: Ruleset) {
for (nation in ruleset.nations.values) { for (nation in ruleset.nations.values) {
checkUniques(nation, lines, rulesetSpecific, tryFixUnknownUniques) checkUniques(nation, lines, rulesetSpecific, tryFixUnknownUniques)
if (nation.cityStateType!=null && nation.cityStateType !in ruleset.cityStateTypes) if (nation.cityStateType != null && nation.cityStateType !in ruleset.cityStateTypes)
lines += "${nation.name} is of city-state type ${nation.cityStateType} which does not exist!" lines += "${nation.name} is of city-state type ${nation.cityStateType} which does not exist!"
if (nation.favoredReligion != null && nation.favoredReligion !in ruleset.religions) if (nation.favoredReligion != null && nation.favoredReligion !in ruleset.religions)
lines += "${nation.name} has ${nation.favoredReligion} as their favored religion, which does not exist!" lines += "${nation.name} has ${nation.favoredReligion} as their favored religion, which does not exist!"