From 110e7b7052c45e2f94aa6cebf5e9d97c5f2c099f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 5 Dec 2019 20:59:44 +0200 Subject: [PATCH] Desktop no longer crashes/bugs on first initialization --- android/assets/jsons/Translations/Techs.json | 2 +- core/src/com/unciv/UncivGame.kt | 2 +- core/src/com/unciv/ui/LanguagePickerScreen.kt | 2 +- desktop/src/com/unciv/app/desktop/DesktopLauncher.kt | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/android/assets/jsons/Translations/Techs.json b/android/assets/jsons/Translations/Techs.json index fffaa2c11c..c5504ca856 100644 --- a/android/assets/jsons/Translations/Techs.json +++ b/android/assets/jsons/Translations/Techs.json @@ -2022,7 +2022,7 @@ Czech:"'Pro spásu duše jsou nezbytné tři věci: vědět čemu věřit; věd Portuguese:"Antiguidade Clássica" German:"Klassik" Czech:"Klasická starověká éra" - Malau:"Era Klasik" + Malay:"Era Klasik" Korean:"고전 시대" } diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 4cd6d20625..84dcbdf246 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -109,7 +109,7 @@ class UncivGame(val version: String) : Game() { // Sometimes, resume() is called and the gameInfo doesn't have any civilizations. // My guess is that resume() was called but create() wasn't, or perhaps was aborted too early, // and the original (and empty) initial GameInfo remained. - if(gameInfo.civilizations.isEmpty()) + if(!::gameInfo.isInitialized || gameInfo.civilizations.isEmpty()) return create() if(::worldScreen.isInitialized) worldScreen.dispose() // I hope this will solve some of the many OuOfMemory exceptions... diff --git a/core/src/com/unciv/ui/LanguagePickerScreen.kt b/core/src/com/unciv/ui/LanguagePickerScreen.kt index db0de27797..a2824e5cc9 100644 --- a/core/src/com/unciv/ui/LanguagePickerScreen.kt +++ b/core/src/com/unciv/ui/LanguagePickerScreen.kt @@ -28,7 +28,7 @@ class LanguageTable(val language:String, ruleSet: RuleSet):Table(){ val availableTranslations = translations.filter { it.value.containsKey(language) } if(language=="English") percentComplete = 100 - else percentComplete = (availableTranslations.size*100 / translations.size) - 5 + else percentComplete = (availableTranslations.size*100 / translations.size) - 1 //-1 so if the user encounters anything not translated he'll be like "OK that's the 1% missing" val spaceSplitLang = language.replace("_"," ") add("$spaceSplitLang ($percentComplete%)".toLabel()) diff --git a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt index 35636024d1..c786b5da2a 100644 --- a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt @@ -64,7 +64,9 @@ internal object DesktopLauncher { thread { while (true) { - updateRpc(game) + try { + updateRpc(game) + }catch (ex:Exception){} Thread.sleep(1000) } }