Added ruleset warnings for empty ally and friend bonuses

We currently use the defaults, but we should phase that out
This commit is contained in:
Yair Morgenstern 2022-02-01 14:51:54 +02:00
parent 8c4bc2927c
commit 0ac2c932f6
2 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class Era : RulesetObject(), IHasUniques {
}
}
/** Since 3.19.5 we have a warning for mods without bonuses, eventually we should treat such mods as providing no bonus */
fun undefinedCityStateBonuses(): Boolean {
return friendBonus.isEmpty() || allyBonus.isEmpty()
}

View File

@ -628,6 +628,7 @@ class Ruleset {
allDifficultiesStartingUnits.addAll(difficulty.playerBonusStartingUnits)
}
val rulesetHasCityStates = nations.values.any { it.isCityState() }
for (era in eras.values) {
for (wonder in era.startingObsoleteWonders)
if (wonder !in buildings)
@ -647,6 +648,13 @@ class Ruleset {
lines += "Unexpected negative number found while parsing era ${era.name}"
if (era.settlerPopulation <= 0)
lines += "Population in cities from settlers must be strictly positive! Found value ${era.settlerPopulation} for era ${era.name}"
if (era.allyBonus.isEmpty() && rulesetHasCityStates)
lines.add("No ally bonus defined for era ${era.name}", RulesetErrorSeverity.Warning)
if (era.friendBonus.isEmpty() && rulesetHasCityStates)
lines.add("No friend bonus defined for era ${era.name}", RulesetErrorSeverity.Warning)
checkUniques(era, lines, UniqueType.UniqueComplianceErrorSeverity.RulesetSpecific)
}