diff --git a/core/src/com/unciv/logic/civilization/Civilization.kt b/core/src/com/unciv/logic/civilization/Civilization.kt index b3e5c0cba3..a5ace7ddc7 100644 --- a/core/src/com/unciv/logic/civilization/Civilization.kt +++ b/core/src/com/unciv/logic/civilization/Civilization.kt @@ -388,7 +388,7 @@ class Civilization : IsPartOfGameInfoSerialization { if (victoryTypes.size == 1) return listOf(victoryTypes.first()) // That is the most relevant one val victoryType: List = listOf(nation.preferredVictoryType, getPersonality().preferredVictoryType) - .filter { it in gameInfo.gameParameters.victoryTypes } + .filter { it in gameInfo.gameParameters.victoryTypes && it in gameInfo.ruleset.victories } return victoryType.ifEmpty { listOf(Constants.neutralVictoryType) } } diff --git a/core/src/com/unciv/logic/github/Github.kt b/core/src/com/unciv/logic/github/Github.kt index ff686e4a3a..88969d02f1 100644 --- a/core/src/com/unciv/logic/github/Github.kt +++ b/core/src/com/unciv/logic/github/Github.kt @@ -105,7 +105,8 @@ object Github { // We DO NOT want to accept "Transfer-Encoding: chunked" here, as we need to know the size for progress tracking // So this attempts to limit the encoding to gzip only // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding - // HOWEVER it doesn't seem to work - the server still sends chunked data sometimes :( + // HOWEVER it doesn't seem to work - the server still sends chunked data sometimes + // which means we don't actually know the total length :( it.setRequestProperty("Accept-Encoding", "gzip") val disposition = it.getHeaderField(contentDispositionHeader) @@ -115,7 +116,7 @@ object Github { // We could check Content-Type=[application/x-zip-compressed] here, but the ZipFile will catch that anyway. Would save some bandwidth, however. contentLength = it.getHeaderField("Content-Length")?.toInt() - ?: 0 + ?: 0 // repo.length is a total lie } ?: return null // Download to temporary zip diff --git a/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt b/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt index 866038e6a3..0c46eb3c19 100644 --- a/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt +++ b/core/src/com/unciv/models/ruleset/validation/RulesetValidator.kt @@ -82,6 +82,7 @@ class RulesetValidator(val ruleset: Ruleset) { addTechColumnErrorsRulesetInvariant(lines) addEraErrors(lines, tryFixUnknownUniques) addSpeedErrors(lines) + addPersonalityErrors(lines) addBeliefErrors(lines, tryFixUnknownUniques) addNationErrors(lines, tryFixUnknownUniques) addPolicyErrors(lines, tryFixUnknownUniques) @@ -408,6 +409,16 @@ class RulesetValidator(val ruleset: Ruleset) { lines.add("Empty turn increment list for game speed ${speed.name}", sourceObject = speed) } } + + private fun addPersonalityErrors(lines: RulesetErrorList) { + for (personality in ruleset.personalities.values) { + if (personality.preferredVictoryType != Constants.neutralVictoryType + && personality.preferredVictoryType !in ruleset.victories) { + lines.add("Preferred victory type ${personality.preferredVictoryType} does not exist in ruleset", + RulesetErrorSeverity.Warning, sourceObject = personality,) + } + } + } private fun addEraErrors( lines: RulesetErrorList,