mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Modding: Added ruleset validation that 2 policies in the same branch do not have the same position
This commit is contained in:
parent
dc7f0434a4
commit
451642450c
@ -331,13 +331,25 @@ class RulesetValidator(val ruleset: Ruleset) {
|
||||
for (prereq in policy.requires!!)
|
||||
if (!ruleset.policies.containsKey(prereq))
|
||||
lines.add("${policy.name} requires policy $prereq which does not exist!", sourceObject = policy)
|
||||
|
||||
uniqueValidator.checkUniques(policy, lines, true, tryFixUnknownUniques)
|
||||
}
|
||||
|
||||
for (branch in ruleset.policyBranches.values)
|
||||
for (branch in ruleset.policyBranches.values) {
|
||||
if (branch.era !in ruleset.eras)
|
||||
lines.add("${branch.name} requires era ${branch.era} which does not exist!", sourceObject = branch)
|
||||
|
||||
val policyLocations = HashMap<String, Policy>()
|
||||
for (policy in branch.policies) {
|
||||
val policyLocation = "${policy.row}/${policy.column}"
|
||||
val existingPolicyInLocation = policyLocations[policyLocation]
|
||||
|
||||
if (existingPolicyInLocation == null) policyLocations[policyLocation] = policy
|
||||
else lines.add("Policies ${policy.name} and ${existingPolicyInLocation.name} in branch ${branch.name}" +
|
||||
" are both located at column ${policy.column} row ${policy.row}!", sourceObject = policy)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (policy in ruleset.policyBranches.values.flatMap { it.policies + it })
|
||||
if (policy != ruleset.policies[policy.name])
|
||||
|
Loading…
Reference in New Issue
Block a user