Scenario now no longer spawns starting units - they should be prebuilt into the scenario!

This commit is contained in:
Yair Morgenstern
2020-08-10 21:18:55 +03:00
parent 8dd8fa3575
commit fd211b1fa3
2 changed files with 27 additions and 28 deletions

View File

@ -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
}

View File

@ -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