No improvement/unit editing for Spectator and Random players (#2836)

This commit is contained in:
Alexander Korolyov 2020-07-12 11:56:55 +02:00 committed by GitHub
parent e03763766b
commit 438a4dbaff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -165,11 +165,12 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
if (UncivGame.Current.scenarioDebugSwitch) {
/** new scenario/improvements functionality
* There shoudn't be random players in scenario
* We shouldn't be able to edit random players or spectators
* */
for (player in gameParameters.players) {
val playerIndex = gameParameters.players.indexOf(player) + 1
if (player.chosenCiv != "Random") {
if (player.chosenCiv == Constants.random || player.chosenCiv == Constants.spectator)
continue
val nation = ruleset.nations[player.chosenCiv]!!
val nationImage = ImageGetter.getNationIndicator(nation, 40f)
nationImage.onClick {
@ -189,13 +190,13 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
setCurrentHex(nationIcon,"Player $playerIndex starting location")
}
nationTable.add(nationImage).row()
}
}
} else {
/** old way improvements for all civs
* */
for(nation in ruleset.nations.values){
if (nation.isSpectator()) continue // no improvements for spectator
val nationImage = getHex(Color.WHITE, ImageGetter.getNationIndicator(nation, 40f))
nationImage.onClick {
val improvementName = "StartingLocation "+nation.name
@ -225,7 +226,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val nationsTable = Table()
// default player - first non-random player or barbarians
// default player - barbarians
var currentPlayer = ""
var currentNation: Nation? = ruleset.nations.values.firstOrNull{ it.isBarbarian() }
@ -265,7 +266,8 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
// player icons
for (player in gameParameters.players) {
if (player.chosenCiv != "Random") {
if (player.chosenCiv == Constants.random || player.chosenCiv == Constants.spectator)
continue
val nation = ruleset.nations[player.chosenCiv]!!
val nationImage = ImageGetter.getNationIndicator(nation, 40f)
nationsTable.add(nationImage).row()
@ -274,7 +276,6 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
currentPlayer = getPlayerIndexString(player)
setUnitTileAction() }
}
}
// barbarians icon
if (!gameParameters.noBarbarians) {