From 9169ec1e42c4725870bcf80f0c0c73ffe82049de Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sat, 9 Apr 2022 23:08:12 +0300 Subject: [PATCH] Hopefully got rid of ANRs when entering a link when the app has been closed for too long? I think that's the problem? --- core/src/com/unciv/UncivGame.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 94768b1da7..6869fb8358 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -75,6 +75,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() { val translations = Translations() override fun create() { + isInitialized = false // this could be on reload, therefore we need to keep setting this to false Gdx.input.setCatchKey(Input.Keys.BACK, true) if (Gdx.app.type != Application.ApplicationType.Desktop) { viewEntireMapForDebug = false @@ -100,7 +101,7 @@ class UncivGame(parameters: UncivGameParameters) : Game() { ImageGetter.resetAtlases() ImageGetter.setNewRuleset(ImageGetter.ruleset) // This needs to come after the settings, since we may have default visual mods - if(settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back + if (settings.tileSet !in ImageGetter.getAvailableTilesets()) { // If one of the tilesets is no longer available, default back settings.tileSet = "FantasyHex" } @@ -166,7 +167,8 @@ class UncivGame(parameters: UncivGameParameters) : Game() { fun tryLoadDeepLinkedGame() { if (deepLinkedMultiplayerGame != null) { try { - loadGame(OnlineMultiplayer().tryDownloadGame(deepLinkedMultiplayerGame!!)) + val onlineGame = OnlineMultiplayer().tryDownloadGame(deepLinkedMultiplayerGame!!) + loadGame(onlineGame) } catch (ex: Exception) { setScreen(MainMenuScreen()) }