diff --git a/android/src/com/unciv/app/AndroidLauncher.kt b/android/src/com/unciv/app/AndroidLauncher.kt index 17b8b01d51..20d667019a 100644 --- a/android/src/com/unciv/app/AndroidLauncher.kt +++ b/android/src/com/unciv/app/AndroidLauncher.kt @@ -33,7 +33,6 @@ class AndroidLauncher : AndroidApplication() { val androidParameters = UncivGameParameters( version = BuildConfig.VERSION_NAME, crashReportSender = CrashReportSenderAndroid(this), - exitEvent = this::finish, fontImplementation = NativeFontAndroid(ORIGINAL_FONT_SIZE.toInt()), customSaveLocationHelper = customSaveLocationHelper ) diff --git a/core/src/com/unciv/UncivGame.kt b/core/src/com/unciv/UncivGame.kt index 8a66d7afff..bd906060e0 100644 --- a/core/src/com/unciv/UncivGame.kt +++ b/core/src/com/unciv/UncivGame.kt @@ -27,7 +27,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() { val version = parameters.version private val crashReportSender = parameters.crashReportSender - val exitEvent = parameters.exitEvent val cancelDiscordEvent = parameters.cancelDiscordEvent val fontImplementation = parameters.fontImplementation val consoleMode = parameters.consoleMode diff --git a/core/src/com/unciv/UncivGameParameters.kt b/core/src/com/unciv/UncivGameParameters.kt index 8bb29f41f5..86357dcb50 100644 --- a/core/src/com/unciv/UncivGameParameters.kt +++ b/core/src/com/unciv/UncivGameParameters.kt @@ -6,8 +6,7 @@ import com.unciv.ui.utils.NativeFontImplementation class UncivGameParameters(val version: String, val crashReportSender: CrashReportSender? = null, - val exitEvent: (()->Unit)? = null, - val cancelDiscordEvent: (()->Unit)? = null, + val cancelDiscordEvent: (() -> Unit)? = null, val fontImplementation: NativeFontImplementation? = null, val consoleMode: Boolean = false, val customSaveLocationHelper: CustomSaveLocationHelper? = null) { diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 46e2b5c9e2..53cfce9e7e 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -689,15 +689,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { return } - // don't show a dialog, if it can't exit the game - if (game.exitEvent == null) { - return - } - val promptWindow = Popup(this) promptWindow.addGoodSizedLabel("Do you want to exit the game?".tr()) promptWindow.row() - promptWindow.addButton("Yes") { game.exitEvent?.invoke() } + promptWindow.addButton("Yes") { Gdx.app.exit() } promptWindow.addButton("No") { promptWindow.close() } diff --git a/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt b/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt index 4685c978a0..bc2d49dea6 100644 --- a/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/ConsoleLauncher.kt @@ -12,12 +12,7 @@ import com.unciv.models.metadata.GameSpeed import com.unciv.models.metadata.Player import com.unciv.models.ruleset.RulesetCache import com.unciv.models.simulation.Simulation -import com.unciv.models.simulation.SimulationStep -import com.unciv.models.simulation.formatDuration import com.unciv.ui.newgamescreen.GameSetupInfo -import java.time.Duration -import kotlin.concurrent.thread -import kotlin.system.exitProcess internal object ConsoleLauncher { @JvmStatic @@ -27,7 +22,6 @@ internal object ConsoleLauncher { val consoleParameters = UncivGameParameters( version, null, - { exitProcess(0) }, null, null, true diff --git a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt index 6d0bcf6bb1..55abdf335a 100644 --- a/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt +++ b/desktop/src/com/unciv/app/desktop/DesktopLauncher.kt @@ -25,7 +25,6 @@ import io.ktor.server.netty.Netty import java.io.File import java.util.* import kotlin.concurrent.timer -import kotlin.system.exitProcess internal object DesktopLauncher { private var discordTimer: Timer? = null @@ -48,7 +47,6 @@ internal object DesktopLauncher { val desktopParameters = UncivGameParameters( versionFromJar, - exitEvent = { exitProcess(0) }, cancelDiscordEvent = { discordTimer?.cancel() }, fontImplementation = NativeFontDesktop(ORIGINAL_FONT_SIZE.toInt()), customSaveLocationHelper = CustomSaveLocationHelperDesktop() diff --git a/tests/src/com/unciv/testing/BasicTests.kt b/tests/src/com/unciv/testing/BasicTests.kt index cc305ff6a6..683aaf67f0 100644 --- a/tests/src/com/unciv/testing/BasicTests.kt +++ b/tests/src/com/unciv/testing/BasicTests.kt @@ -10,7 +10,6 @@ import com.unciv.models.ruleset.RulesetCache import com.unciv.models.ruleset.unit.BaseUnit import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats -import com.unciv.models.translations.tr import org.junit.Assert import org.junit.Before import org.junit.Test @@ -40,7 +39,7 @@ class BasicTests { @Test fun gameIsNotRunWithDebugModes() { - val params = UncivGameParameters("", null, null) + val params = UncivGameParameters("", null) val game = UncivGame(params) Assert.assertTrue("This test will only pass if the game is not run with debug modes", !game.superchargedForDebug