mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -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?!")
|
"but its type ${unique.type} only ${unique.type.parameterTypeMap.size} parameters?!")
|
||||||
}
|
}
|
||||||
val acceptableParamTypes = unique.type.parameterTypeMap[index]
|
val acceptableParamTypes = unique.type.parameterTypeMap[index]
|
||||||
|
if (acceptableParamTypes.size == 0) continue // This is a deprecated parameter type, don't bother checking it
|
||||||
|
|
||||||
val errorTypesForAcceptableParameters =
|
val errorTypesForAcceptableParameters =
|
||||||
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }
|
acceptableParamTypes.map { getParamTypeErrorSeverityCached(it, param) }
|
||||||
if (errorTypesForAcceptableParameters.any { it == null }) continue // This matches one of the types!
|
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!
|
continue // This is a filtering param, and the unique it's filtering for actually exists, no problem here!
|
||||||
val leastSevereWarning =
|
val leastSevereWarning =
|
||||||
errorTypesForAcceptableParameters.minByOrNull { it!!.ordinal }
|
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)
|
errorList += UniqueComplianceError(param, acceptableParamTypes, leastSevereWarning)
|
||||||
}
|
}
|
||||||
return errorList
|
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"
|
??? example "Doubles Gold given to enemy if city is captured"
|
||||||
Applicable to: Building
|
Applicable to: Building
|
||||||
|
|
||||||
??? example "Remove extra unhappiness from annexed cities"
|
??? example "Removes extra unhappiness from annexed cities"
|
||||||
Applicable to: Building
|
Applicable to: Building
|
||||||
|
|
||||||
??? example "Connects trade routes over water"
|
??? example "Connects trade routes over water"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user