diff --git a/core/src/com/unciv/logic/GameStarter.kt b/core/src/com/unciv/logic/GameStarter.kt index 8ddb32cb11..c853a78d07 100644 --- a/core/src/com/unciv/logic/GameStarter.kt +++ b/core/src/com/unciv/logic/GameStarter.kt @@ -35,6 +35,7 @@ object GameStarter { for(unit in tile.getUnits()) if(gameInfo.civilizations.none { it.civName== unit.owner}){ unit.currentTile=tile + unit.setTransients(ruleset) unit.removeFromTile() } @@ -67,7 +68,8 @@ object GameStarter { } // and only now do we add units for everyone, because otherwise both the gameInfo.setTransients() and the placeUnit will both add the unit to the civ's unit list! - addCivStartingUnits(gameInfo) + if (gameSetupInfo.mapParameters.type != MapType.scenario) + addCivStartingUnits(gameInfo) return gameInfo } diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt index 2d0a5de534..dbcf872a64 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt @@ -96,28 +96,6 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe private fun newGameThread() { try { newGame = GameStarter.startNewGame(gameSetupInfo) - if (gameSetupInfo.gameParameters.isOnlineMultiplayer) { - newGame!!.isUpToDate = true // So we don't try to download it from dropbox the second after we upload it - the file is not yet ready for loading! - try { - OnlineMultiplayer().tryUploadGame(newGame!!) - GameSaver.autoSave(newGame!!) {} - - // Saved as Multiplayer game to show up in the session browser - GameSaver.saveGame(newGame!!, newGame!!.gameId, true) - // Save gameId to clipboard because you have to do it anyway. - Gdx.app.clipboard.contents = newGame!!.gameId - // Popup to notify the User that the gameID got copied to the clipboard - Gdx.app.postRunnable { ResponsePopup("gameID copied to clipboard".tr(), UncivGame.Current.worldScreen, 2500) } - } catch (ex: Exception) { - Gdx.app.postRunnable { - val cantUploadNewGamePopup = Popup(this) - cantUploadNewGamePopup.addGoodSizedLabel("Could not upload game!") - cantUploadNewGamePopup.addCloseButton() - cantUploadNewGamePopup.open() - } - newGame = null - } - } } catch (exception: Exception) { Gdx.app.postRunnable { val cantMakeThatMapPopup = Popup(this) @@ -130,14 +108,33 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe rightSideButton.setText("Start game!".tr()) } } + + if (gameSetupInfo.gameParameters.isOnlineMultiplayer) { + newGame!!.isUpToDate = true // So we don't try to download it from dropbox the second after we upload it - the file is not yet ready for loading! + try { + OnlineMultiplayer().tryUploadGame(newGame!!) + GameSaver.autoSave(newGame!!) {} + + // Saved as Multiplayer game to show up in the session browser + GameSaver.saveGame(newGame!!, newGame!!.gameId, true) + // Save gameId to clipboard because you have to do it anyway. + Gdx.app.clipboard.contents = newGame!!.gameId + // Popup to notify the User that the gameID got copied to the clipboard + Gdx.app.postRunnable { ResponsePopup("gameID copied to clipboard".tr(), UncivGame.Current.worldScreen, 2500) } + } catch (ex: Exception) { + Gdx.app.postRunnable { + val cantUploadNewGamePopup = Popup(this) + cantUploadNewGamePopup.addGoodSizedLabel("Could not upload game!") + cantUploadNewGamePopup.addCloseButton() + cantUploadNewGamePopup.open() + } + newGame = null + } + } + Gdx.graphics.requestRendering() } -// fun setNewGameButtonEnabled(bool: Boolean) { -// if (bool) rightSideButton.enable() -// else rightSideButton.disable() -// } - fun lockTables() { playerPickerTable.locked = true newGameOptionsTable.locked = true