From 0ac2c932f67468fb31f03814e6bb03fabeedd995 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 1 Feb 2022 14:51:54 +0200 Subject: [PATCH] Added ruleset warnings for empty ally and friend bonuses We currently use the defaults, but we should phase that out --- core/src/com/unciv/models/ruleset/Era.kt | 1 + core/src/com/unciv/models/ruleset/Ruleset.kt | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/core/src/com/unciv/models/ruleset/Era.kt b/core/src/com/unciv/models/ruleset/Era.kt index d50d24198e..2f295e4d5a 100644 --- a/core/src/com/unciv/models/ruleset/Era.kt +++ b/core/src/com/unciv/models/ruleset/Era.kt @@ -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() } diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index e548e56542..270ccf04e7 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -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) }