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,6 +68,7 @@ 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!
if (gameSetupInfo.mapParameters.type != MapType.scenario)
addCivStartingUnits(gameInfo)
return gameInfo

View File

@ -96,6 +96,19 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
private fun newGameThread() {
try {
newGame = GameStarter.startNewGame(gameSetupInfo)
} catch (exception: Exception) {
Gdx.app.postRunnable {
val cantMakeThatMapPopup = Popup(this)
cantMakeThatMapPopup.addGoodSizedLabel("It looks like we can't make a map with the parameters you requested!".tr()).row()
cantMakeThatMapPopup.addGoodSizedLabel("Maybe you put too many players into too small a map?".tr()).row()
cantMakeThatMapPopup.addCloseButton()
cantMakeThatMapPopup.open()
Gdx.input.inputProcessor = stage
rightSideButton.enable()
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 {
@ -118,26 +131,10 @@ class NewGameScreen(previousScreen:CameraStageBaseScreen, _gameSetupInfo: GameSe
newGame = null
}
}
} catch (exception: Exception) {
Gdx.app.postRunnable {
val cantMakeThatMapPopup = Popup(this)
cantMakeThatMapPopup.addGoodSizedLabel("It looks like we can't make a map with the parameters you requested!".tr()).row()
cantMakeThatMapPopup.addGoodSizedLabel("Maybe you put too many players into too small a map?".tr()).row()
cantMakeThatMapPopup.addCloseButton()
cantMakeThatMapPopup.open()
Gdx.input.inputProcessor = stage
rightSideButton.enable()
rightSideButton.setText("Start game!".tr())
}
}
Gdx.graphics.requestRendering()
}
// fun setNewGameButtonEnabled(bool: Boolean) {
// if (bool) rightSideButton.enable()
// else rightSideButton.disable()
// }
fun lockTables() {
playerPickerTable.locked = true
newGameOptionsTable.locked = true