File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
core/src/com/unciv/models/ruleset Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -213,13 +213,28 @@ class Ruleset {
213213 nations.remove(it)
214214 }
215215 nations.putAll(ruleset.nations)
216+
217+ /* * We must remove all policies from a policy branch otherwise we have policies that cannot be picked
218+ * but are still considered "available" */
219+ fun removePolicyBranch (policyBranch : PolicyBranch ){
220+ policyBranches.remove(policyBranch.name)
221+ for (policy in policyBranch.policies)
222+ policies.remove(policy.name)
223+ }
224+
216225 ruleset.modOptions.policyBranchesToRemove
217226 .flatMap { policyBranchToRemove ->
218- policyBranches.filter { it.value.matchesFilter(policyBranchToRemove) }.keys
227+ policyBranches.filter { it.value.matchesFilter(policyBranchToRemove) }.values
219228 }.toSet().forEach {
220- policyBranches.remove (it)
229+ removePolicyBranch (it)
221230 }
231+
232+ val overriddenPolicyBranches = policyBranches
233+ .filter { it.key in ruleset.policyBranches }.map { it.value }
234+ for (policyBranch in overriddenPolicyBranches) removePolicyBranch(policyBranch
235+ )
222236 policyBranches.putAll(ruleset.policyBranches)
237+
223238 policies.putAll(ruleset.policies)
224239
225240 // Remove the policies
You can’t perform that action at this time.
0 commit comments