From eb0fd17d9b226189f3dac1fd025477ffe56cecb7 Mon Sep 17 00:00:00 2001 From: JackRainy Date: Sat, 22 Feb 2020 23:10:52 +0200 Subject: [PATCH] Fix of the click on unknown civilization (#1989) * Fix of the click on unknown civilization * Minor optimization * Better naming of variable --- core/src/com/unciv/ui/tilegroups/CityButton.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/ui/tilegroups/CityButton.kt b/core/src/com/unciv/ui/tilegroups/CityButton.kt index febcb473fc..da8b4f0d07 100644 --- a/core/src/com/unciv/ui/tilegroups/CityButton.kt +++ b/core/src/com/unciv/ui/tilegroups/CityButton.kt @@ -70,13 +70,14 @@ class CityButton(val city: CityInfo, internal val tileGroup: WorldTileGroup, ski // clicking swings the button a little down to allow selection of units there. // this also allows to target selected units to move to the city tile from elsewhere. if (isButtonMoved) { + val viewingCiv = UncivGame.Current.worldScreen.viewingCiv // second tap on the button will go to the city screen // if this city belongs to you if (UncivGame.Current.viewEntireMapForDebug || belongsToViewingCiv()) { UncivGame.Current.setScreen(CityScreen(city)) - } else { + } else if (viewingCiv.knows(city.civInfo)) { // If city doesn't belong to you, go directly to its owner's diplomacy screen. - val screen = DiplomacyScreen(UncivGame.Current.worldScreen.viewingCiv) + val screen = DiplomacyScreen(viewingCiv) screen.updateRightSide(city.civInfo) UncivGame.Current.setScreen(screen) }