From d8c238bf97bde8ff8decaeb24e09d8c0c3deb65f Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 24 Apr 2019 21:14:53 +0300 Subject: [PATCH] Added a popup for people who try to create a game and fail --- android/build.gradle | 4 ++-- core/src/com/unciv/ui/NewGameScreen.kt | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 341d7ae9b8..4a68921bdc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 28 - versionCode 230 - versionName "2.14.10" + versionCode 231 + versionName "2.15.0" } // Had to add this crap for Travis to build, it wanted to sign the app diff --git a/core/src/com/unciv/ui/NewGameScreen.kt b/core/src/com/unciv/ui/NewGameScreen.kt index 3a0ddc11b4..38c66335e1 100644 --- a/core/src/com/unciv/ui/NewGameScreen.kt +++ b/core/src/com/unciv/ui/NewGameScreen.kt @@ -18,6 +18,7 @@ import com.unciv.ui.utils.enable import com.unciv.ui.utils.onClick import com.unciv.ui.utils.toLabel import com.unciv.ui.worldscreen.WorldScreen +import com.unciv.ui.worldscreen.optionstable.PopupTable import kotlin.concurrent.thread import kotlin.math.min @@ -95,7 +96,15 @@ class NewGameScreen: PickerScreen(){ rightSideButton.setText("Working...".tr()) thread { // Creating a new game can take a while and we don't want ANRs - newGame = GameStarter().startNewGame(newGameParameters) + try { + newGame = GameStarter().startNewGame(newGameParameters) + } + catch (exception:Exception){ + val popup = PopupTable(this) + popup.addGoodSizedLabel("It looks like we can't make a map with the parameters you requested!").row() + popup.addGoodSizedLabel("Maybe you put too many players into too small a map?").row() + popup.open() + } } }