Do not trigger the Time Victory if it is not enabled (#7197)

* Whitespaces

* Use the proper list of victory types

* Clean up if the victory type was removed
This commit is contained in:
Jack Rainy 2022-06-18 21:44:07 +03:00 committed by GitHub
parent 1facd97782
commit 35a4f079b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -55,7 +55,7 @@ class VictoryManager {
fun getVictoryTypeAchieved(): String? {
if (!civInfo.isMajorCiv()) return null
for (victoryName in civInfo.gameInfo.ruleSet.victories.keys.filter { it != Constants.neutralVictoryType}) {
for (victoryName in civInfo.gameInfo.gameParameters.victoryTypes.filter { it != Constants.neutralVictoryType}) {
if (getNextMilestone(victoryName) == null)
return victoryName
}

View File

@ -57,6 +57,9 @@ class NewGameScreen(
updateRuleset() // must come before playerPickerTable so mod nations from fromSettings
// Has to be initialized before the mapOptionsTable, since the mapOptionsTable refers to it on init
// remove the victory types which are not in the rule set (e.g. were in the recently disabled mod)
gameSetupInfo.gameParameters.victoryTypes.removeAll { it !in ruleset.victories.keys }
if (gameSetupInfo.gameParameters.victoryTypes.isEmpty())
gameSetupInfo.gameParameters.victoryTypes.addAll(ruleset.victories.keys)