mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-24 21:51:14 +07:00
Fixed crash where deleting mods meant you could never start a game again
If the last game you created used a mod that you later removed from the the device it could never be removed from the new game parameters Caught exceptions from quickstart failing
This commit is contained in:
parent
5f0afffe5a
commit
5170a27e07
@ -657,7 +657,8 @@ Main menu =
|
||||
Resume =
|
||||
Cannot resume game! =
|
||||
Not enough memory on phone to load game! =
|
||||
Quickstart =
|
||||
Quickstart =
|
||||
Cannot start game with the default new game parameters! =
|
||||
Victory status =
|
||||
Social policies =
|
||||
Community =
|
||||
|
@ -236,8 +236,12 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
private fun quickstartNewGame() {
|
||||
val newGame = GameStarter.startNewGame(GameSetupInfo.fromSettings("Chieftain"))
|
||||
game.loadGame(newGame)
|
||||
try {
|
||||
val newGame = GameStarter.startNewGame(GameSetupInfo.fromSettings("Chieftain"))
|
||||
game.loadGame(newGame)
|
||||
} catch (ex: Exception) {
|
||||
ToastPopup("Cannot start game with the default new game parameters!", this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
|
@ -32,6 +32,10 @@ object GameStarter {
|
||||
val gameInfo = GameInfo()
|
||||
lateinit var tileMap: TileMap
|
||||
|
||||
// In the case where we used to have a mod, and now we don't, we cannot "unselect" it in the UI.
|
||||
// We need to remove the dead mods so there aren't problems later.
|
||||
gameSetupInfo.gameParameters.mods.removeAll{ !RulesetCache.containsKey(it) }
|
||||
|
||||
gameInfo.gameParameters = gameSetupInfo.gameParameters
|
||||
val ruleset = RulesetCache.getComplexRuleset(gameInfo.gameParameters.mods)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user