mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 11:34:54 -04:00
modcheck: Handle case where a deprecated unique used a parameter type that no longer exists
This commit is contained in:
parent
41eceeb834
commit
454b86cdc1
@ -312,6 +312,8 @@ class UniqueValidator(val ruleset: Ruleset) {
|
||||
"but its type ${unique.type} only ${unique.type.parameterTypeMap.size} parameters?!")
|
||||
}
|
||||
val acceptableParamTypes = unique.type.parameterTypeMap[index]
|
||||
if (acceptableParamTypes.size == 0) continue // This is a deprecated parameter type, don't bother checking it
|
||||
|
||||
val errorTypesForAcceptableParameters =
|
||||
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }
|
||||
if (errorTypesForAcceptableParameters.any { it == null }) continue // This matches one of the types!
|
||||
@ -320,7 +322,8 @@ class UniqueValidator(val ruleset: Ruleset) {
|
||||
continue // This is a filtering param, and the unique it's filtering for actually exists, no problem here!
|
||||
val leastSevereWarning =
|
||||
errorTypesForAcceptableParameters.minByOrNull { it!!.ordinal }
|
||||
if (leastSevereWarning == null) throw Exception("Unique ${unique.text} from mod ${ruleset.name} is acting strangely - please open a bug report")
|
||||
if (leastSevereWarning == null)
|
||||
throw Exception("Unique ${unique.text} from mod ${ruleset.name} is acting strangely - please open a bug report")
|
||||
errorList += UniqueComplianceError(param, acceptableParamTypes, leastSevereWarning)
|
||||
}
|
||||
return errorList
|
||||
|
@ -1575,7 +1575,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
??? example "Doubles Gold given to enemy if city is captured"
|
||||
Applicable to: Building
|
||||
|
||||
??? example "Remove extra unhappiness from annexed cities"
|
||||
??? example "Removes extra unhappiness from annexed cities"
|
||||
Applicable to: Building
|
||||
|
||||
??? example "Connects trade routes over water"
|
||||
|
Loading…
x
Reference in New Issue
Block a user