Desktop no longer crashes/bugs on first initialization

This commit is contained in:
Yair Morgenstern 2019-12-05 20:59:44 +02:00
parent b9487c1800
commit 110e7b7052
4 changed files with 6 additions and 4 deletions

View File

@ -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:"고전 시대"
}

View File

@ -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...

View File

@ -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())

View File

@ -64,7 +64,9 @@ internal object DesktopLauncher {
thread {
while (true) {
updateRpc(game)
try {
updateRpc(game)
}catch (ex:Exception){}
Thread.sleep(1000)
}
}