From d674be22343510e00ed8c8cebb775642e33cff6b Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Tue, 20 Apr 2021 22:18:11 +0300 Subject: [PATCH] Can no longer enter diplomacy screen for self, defeated and spectator civs through diplomacy overview screen --- buildSrc/src/main/kotlin/BuildConfig.kt | 2 -- .../unciv/ui/overviewscreen/EmpireOverviewScreen.kt | 13 +++++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/kotlin/BuildConfig.kt b/buildSrc/src/main/kotlin/BuildConfig.kt index d882195e70..ec537d2689 100644 --- a/buildSrc/src/main/kotlin/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/BuildConfig.kt @@ -8,6 +8,4 @@ object BuildConfig { const val gdxVersion = "1.10.0" const val roboVMVersion = "2.3.1" - const val ashleyVersion = "1.7.0" - const val aiVersion = "1.8.0" } \ No newline at end of file diff --git a/core/src/com/unciv/ui/overviewscreen/EmpireOverviewScreen.kt b/core/src/com/unciv/ui/overviewscreen/EmpireOverviewScreen.kt index 6f064f124f..dd51ecb156 100644 --- a/core/src/com/unciv/ui/overviewscreen/EmpireOverviewScreen.kt +++ b/core/src/com/unciv/ui/overviewscreen/EmpireOverviewScreen.kt @@ -98,7 +98,8 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa fun update(){ clear() - val relevantCivs = viewingPlayer.gameInfo.civilizations.filter { !it.isBarbarian() && (includeCityStates || !it.isCityState()) } + val relevantCivs = viewingPlayer.gameInfo.civilizations + .filter { !it.isBarbarian() && (includeCityStates || !it.isCityState()) } val diplomacyGroup = DiplomacyGroup(viewingPlayer, diplomacyGroupHeight, includeCityStates) val playerKnowsAndUndefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && !it.isDefeated() } val playerKnowsAndDefeatedCivs = relevantCivs.filter { diplomacyGroup.playerKnows(it) && it.isDefeated() } @@ -130,20 +131,23 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa table.add(civInfo.civName.toLabel()).left() table.touchable = Touchable.enabled table.onClick { + if (civInfo.isDefeated() || viewingPlayer.isSpectator() || civInfo == viewingPlayer) return@onClick UncivGame.Current.setScreen(DiplomacyScreen(viewingPlayer).apply { updateRightSide(civInfo) }) } return table } private fun getCivTableScroll(relevantCivs: List, titleTable: Table, - playerKnowsAndUndefeatedCivs: List, playerKnowsAndDefeatedCivs: List): ScrollPane { + playerKnowsAndUndefeatedCivs: List, + playerKnowsAndDefeatedCivs: List): ScrollPane { val civTable = Table() civTable.defaults().pad(5f) civTable.background = ImageGetter.getBackground(Color.BLACK) civTable.add("[${relevantCivs.size}] Civilizations in the game".toLabel()).pad(5f).colspan(2).row() civTable.add(titleTable).colspan(2).row() civTable.addSeparator() - civTable.add("Known and alive ([${playerKnowsAndUndefeatedCivs.size - 1}])".toLabel()).pad(5f).colspan(2).row() + civTable.add("Known and alive ([${playerKnowsAndUndefeatedCivs.size - 1}])".toLabel()) + .pad(5f).colspan(2).row() if (playerKnowsAndUndefeatedCivs.size > 1) { civTable.addSeparator() playerKnowsAndUndefeatedCivs.filter { it != viewingPlayer }.forEach { @@ -152,7 +156,8 @@ class EmpireOverviewScreen(private var viewingPlayer:CivilizationInfo, defaultPa } } civTable.addSeparator() - civTable.add("Known and defeated ([${playerKnowsAndDefeatedCivs.size}])".toLabel()).pad(5f).colspan(2).row() + civTable.add("Known and defeated ([${playerKnowsAndDefeatedCivs.size}])".toLabel()) + .pad(5f).colspan(2).row() if (playerKnowsAndDefeatedCivs.isNotEmpty()) { civTable.addSeparator() playerKnowsAndDefeatedCivs.forEach {