From 52f797c8e3b9719b7dfc6baa6535268f03a94cc1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 28 Mar 2022 16:43:04 +0300 Subject: [PATCH] Added check for multiple policies with the same name - unlike techs buildings etc, these are also saved in the *policy branch* and so can affect gameplay --- core/src/com/unciv/models/ruleset/Ruleset.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index 2cc7f584e6..ba4fd2e316 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -745,6 +745,10 @@ class Ruleset { lines += "${policy.name} requires policy $prereq which does not exist!" checkUniques(policy, lines, rulesetSpecific, forOptionsPopup) } + + for (policy in policyBranches.values.flatMap { it.policies + it }) + if (policy != policies[policy.name]) + lines += "More than one policy with the name ${policy.name} exists!" for (reward in ruinRewards.values) { for (difficulty in reward.excludedDifficulties) @@ -870,7 +874,8 @@ object RulesetCache : HashMap() { val newRuleset = Ruleset() val baseRuleset = - if (containsKey(optionalBaseRuleset) && this[optionalBaseRuleset]!!.modOptions.isBaseRuleset) this[optionalBaseRuleset]!! + if (containsKey(optionalBaseRuleset) && this[optionalBaseRuleset]!!.modOptions.isBaseRuleset) + this[optionalBaseRuleset]!! else getVanillaRuleset()