From 650a43aa3b4918ee15fd3834b926452edc55bdff Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Sun, 25 Jun 2023 08:03:44 +0200 Subject: [PATCH] Make UncivGame.isInitialized inaccessible outside of the class hierarchy (#9651) * Make UncivGame.isInitialized inaccessible outside of the class hierarchy * Fix JvmName --- android/src/com/unciv/app/AndroidGame.kt | 1 + android/src/com/unciv/app/AndroidLauncher.kt | 2 +- core/src/com/unciv/UncivGame.kt | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/android/src/com/unciv/app/AndroidGame.kt b/android/src/com/unciv/app/AndroidGame.kt index b0403ea568..b98191c5df 100644 --- a/android/src/com/unciv/app/AndroidGame.kt +++ b/android/src/com/unciv/app/AndroidGame.kt @@ -78,4 +78,5 @@ class AndroidGame(private val activity: Activity) : UncivGame() { } } + fun isInitializedProxy() = super.isInitialized } diff --git a/android/src/com/unciv/app/AndroidLauncher.kt b/android/src/com/unciv/app/AndroidLauncher.kt index e0c61d5b0b..aab09a2d18 100644 --- a/android/src/com/unciv/app/AndroidLauncher.kt +++ b/android/src/com/unciv/app/AndroidLauncher.kt @@ -70,7 +70,7 @@ open class AndroidLauncher : AndroidApplication() { override fun onPause() { val game = this.game!! - if (game.isInitialized + if (game.isInitializedProxy() && game.gameInfo != null && game.settings.multiplayer.turnCheckerEnabled && game.files.getMultiplayerSaves().any() diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 0d0e6408f8..b318d8e37c 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -137,7 +137,9 @@ open class UncivGame(val isConsoleMode: Boolean = false) : Game(), PlatformSpeci var worldScreen: WorldScreen? = null private set - var isInitialized = false + /** Flag used only during initialization until the end of [create] */ + protected var isInitialized = false + private set /** A wrapped render() method that crashes to [CrashScreen] on a unhandled exception or error. */ private val wrappedCrashHandlingRender = { super.render() }.wrapCrashHandlingUnit()