mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 13:55:54 -04: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
@ -658,6 +658,7 @@ Resume =
|
|||||||
Cannot resume game! =
|
Cannot resume game! =
|
||||||
Not enough memory on phone to load game! =
|
Not enough memory on phone to load game! =
|
||||||
Quickstart =
|
Quickstart =
|
||||||
|
Cannot start game with the default new game parameters! =
|
||||||
Victory status =
|
Victory status =
|
||||||
Social policies =
|
Social policies =
|
||||||
Community =
|
Community =
|
||||||
|
@ -236,8 +236,12 @@ class MainMenuScreen: CameraStageBaseScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun quickstartNewGame() {
|
private fun quickstartNewGame() {
|
||||||
val newGame = GameStarter.startNewGame(GameSetupInfo.fromSettings("Chieftain"))
|
try {
|
||||||
game.loadGame(newGame)
|
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) {
|
override fun resize(width: Int, height: Int) {
|
||||||
|
@ -32,6 +32,10 @@ object GameStarter {
|
|||||||
val gameInfo = GameInfo()
|
val gameInfo = GameInfo()
|
||||||
lateinit var tileMap: TileMap
|
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
|
gameInfo.gameParameters = gameSetupInfo.gameParameters
|
||||||
val ruleset = RulesetCache.getComplexRuleset(gameInfo.gameParameters.mods)
|
val ruleset = RulesetCache.getComplexRuleset(gameInfo.gameParameters.mods)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user