fix no victoryTypes for the first time gaming with "quick game" opion. (#7785)

This commit is contained in:
nacro711072 2022-09-12 05:34:47 +08:00 committed by GitHub
parent 351c6aa798
commit d65c756e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -227,7 +227,13 @@ class MainMenuScreen: BaseScreen(), RecreateOnResize {
val newGame: GameInfo
// Can fail when starting the game...
try {
newGame = GameStarter.startNewGame(GameSetupInfo.fromSettings("Chieftain"))
val gameInfo = GameSetupInfo.fromSettings("Chieftain")
if (gameInfo.gameParameters.victoryTypes.isEmpty()) {
val ruleSet = RulesetCache.getComplexRuleset(gameInfo.gameParameters)
gameInfo.gameParameters.victoryTypes.addAll(ruleSet.victories.keys)
}
newGame = GameStarter.startNewGame(gameInfo)
} catch (notAPlayer: UncivShowableException) {
val (message) = LoadGameScreen.getLoadExceptionMessage(notAPlayer)
launchOnGLThread { ToastPopup(message, this@MainMenuScreen) }