mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 19:43:13 -04:00
Resolved #12548 - Spy stationed in city allows, but does not force, viewing the city when clicking on city button
This commit is contained in:
parent
24eae9d951
commit
b8b88935a2
@ -529,8 +529,7 @@ class CityButton(val city: City, private val tileGroup: TileGroup) : Table(BaseS
|
|||||||
// second tap on the button will go to the city screen
|
// second tap on the button will go to the city screen
|
||||||
// if this city belongs to you and you are not iterating though the air units
|
// if this city belongs to you and you are not iterating though the air units
|
||||||
if (DebugUtils.VISIBLE_MAP || viewingPlayer.isSpectator()
|
if (DebugUtils.VISIBLE_MAP || viewingPlayer.isSpectator()
|
||||||
|| belongsToViewingCiv() && !tileGroup.tile.airUnits.contains(unitTable.selectedUnit)
|
|| belongsToViewingCiv() && !tileGroup.tile.airUnits.contains(unitTable.selectedUnit)) {
|
||||||
|| city.civ.gameInfo.isEspionageEnabled() && viewingPlayer.espionageManager.getSpyAssignedToCity(city)?.isSetUp() == true) {
|
|
||||||
GUI.pushScreen(CityScreen(city))
|
GUI.pushScreen(CityScreen(city))
|
||||||
} else if (viewingPlayer.knows(city.civ)) {
|
} else if (viewingPlayer.knows(city.civ)) {
|
||||||
foreignCityInfoPopup()
|
foreignCityInfoPopup()
|
||||||
@ -585,19 +584,21 @@ class CityButton(val city: City, private val tileGroup: TileGroup) : Table(BaseS
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun foreignCityInfoPopup() {
|
private fun foreignCityInfoPopup() {
|
||||||
fun openDiplomacy() {
|
fun openDiplomacy() = GUI.pushScreen(DiplomacyScreen(viewingPlayer, city.civ))
|
||||||
// If city doesn't belong to you, go directly to its owner's diplomacy screen.
|
|
||||||
GUI.pushScreen(DiplomacyScreen(viewingPlayer, city.civ))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
val espionageVisible = city.civ.gameInfo.isEspionageEnabled()
|
||||||
|
&& viewingPlayer.espionageManager.getSpyAssignedToCity(city)?.isSetUp() == true
|
||||||
|
|
||||||
// If there's nothing to display cuz no Religion - skip popup
|
// If there's nothing to display cuz no Religion - skip popup
|
||||||
if (!city.civ.gameInfo.isReligionEnabled()) return openDiplomacy()
|
if (!city.civ.gameInfo.isReligionEnabled() && !espionageVisible) return openDiplomacy()
|
||||||
|
|
||||||
val popup = Popup(GUI.getWorldScreen()).apply {
|
val popup = Popup(GUI.getWorldScreen()).apply {
|
||||||
name = "ForeignCityInfoPopup"
|
name = "ForeignCityInfoPopup"
|
||||||
add(CityTable(city, true)).fillX().padBottom(5f).colspan(3).row()
|
add(CityTable(city, true)).fillX().padBottom(5f).colspan(3).row()
|
||||||
add(CityReligionInfoTable(city.religion, true)).colspan(3).row()
|
if (city.civ.gameInfo.isReligionEnabled())
|
||||||
|
add(CityReligionInfoTable(city.religion, true)).colspan(3).row()
|
||||||
addOKButton("Diplomacy") { openDiplomacy() }
|
addOKButton("Diplomacy") { openDiplomacy() }
|
||||||
|
if (espionageVisible) addButton("View") { GUI.pushScreen(CityScreen(city)) }
|
||||||
add().expandX()
|
add().expandX()
|
||||||
addCloseButton() {
|
addCloseButton() {
|
||||||
GUI.getWorldScreen().run { nextTurnButton.update() }
|
GUI.getWorldScreen().run { nextTurnButton.update() }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user