From f52ad60b516462fc8edd9716b917de3987cd5769 Mon Sep 17 00:00:00 2001 From: alexban011 Date: Mon, 2 May 2022 22:06:05 +0300 Subject: [PATCH] Fixed issue #6649 by checking for internet connection before starting the game if "online multiplayer" is selected Many thanks to @SomeTroglodyte for most of the code and for explanations --- core/src/com/unciv/ui/worldscreen/mainmenu/OptionsPopup.kt | 2 +- .../com/unciv/app/desktop/PlatformSpecificHelpersDesktop.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/com/unciv/ui/worldscreen/mainmenu/OptionsPopup.kt b/core/src/com/unciv/ui/worldscreen/mainmenu/OptionsPopup.kt index 2c7362d197..9cc3b03875 100644 --- a/core/src/com/unciv/ui/worldscreen/mainmenu/OptionsPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/mainmenu/OptionsPopup.kt @@ -425,7 +425,7 @@ class OptionsPopup(val previousScreen: BaseScreen) : Popup(previousScreen) { } for (line in modLinks) { val label = Label(line.text, BaseScreen.skin) - .apply { color = line.errorSeverityToReport.color } + .apply { color = line.errorSeverityToReport.color } label.wrap = true it.add(label).width(stage.width / 2).row() } diff --git a/desktop/src/com/unciv/app/desktop/PlatformSpecificHelpersDesktop.kt b/desktop/src/com/unciv/app/desktop/PlatformSpecificHelpersDesktop.kt index 9bb0695ab5..90539ac95d 100644 --- a/desktop/src/com/unciv/app/desktop/PlatformSpecificHelpersDesktop.kt +++ b/desktop/src/com/unciv/app/desktop/PlatformSpecificHelpersDesktop.kt @@ -9,9 +9,9 @@ class PlatformSpecificHelpersDesktop : GeneralPlatformSpecificHelpers { } override fun isInternetConnected(): Boolean { - return try{ + return try { InetAddress.getByName("8.8.8.8").isReachable(500) // Parameter timeout in milliseconds - }catch (ex: Exception){ + } catch (ex: Throwable) { false } }