From 51125b68a8af7781cc6e0a40d7dd92bae1683001 Mon Sep 17 00:00:00 2001
From: Yair Morgenstern <yairm210@hotmail.com>
Date: Sun, 28 Mar 2021 21:22:45 +0300
Subject: [PATCH] City attack notifications show icon

---
 core/src/com/unciv/logic/battle/Battle.kt                | 6 +++++-
 core/src/com/unciv/logic/civilization/Notification.kt    | 2 +-
 core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt | 7 +++----
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/core/src/com/unciv/logic/battle/Battle.kt b/core/src/com/unciv/logic/battle/Battle.kt
index 0881904e3f..6b413a1da7 100644
--- a/core/src/com/unciv/logic/battle/Battle.kt
+++ b/core/src/com/unciv/logic/battle/Battle.kt
@@ -14,6 +14,7 @@ import com.unciv.logic.map.TileInfo
 import com.unciv.models.AttackableTile
 import com.unciv.models.ruleset.Unique
 import com.unciv.models.ruleset.unit.UnitType
+import com.unciv.ui.utils.ImageGetter
 import java.util.*
 import kotlin.math.max
 
@@ -174,7 +175,10 @@ object Battle {
                         else " [" + defender.getName() + "]"
                     else " our [" + defender.getName() + "]"
             val notificationString = attackerString + whatHappenedString + defenderString
-            defender.getCivInfo().addNotification(notificationString, attackedTile.position, attacker.getName(), NotificationIcon.War, defender.getName())
+            val cityIcon = "ImprovementIcons/Citadel"
+            val attackerIcon = if (attacker is CityCombatant) cityIcon else attacker.getName()
+            val defenderIcon = if (defender is CityCombatant) cityIcon else defender.getName()
+            defender.getCivInfo().addNotification(notificationString, attackedTile.position, attackerIcon, NotificationIcon.War, defenderIcon)
         }
     }
 
diff --git a/core/src/com/unciv/logic/civilization/Notification.kt b/core/src/com/unciv/logic/civilization/Notification.kt
index c52a71d5ab..2682a36977 100644
--- a/core/src/com/unciv/logic/civilization/Notification.kt
+++ b/core/src/com/unciv/logic/civilization/Notification.kt
@@ -15,7 +15,7 @@ object NotificationIcon {
     val Trade = "StatIcons/Acquire"
     val Science = "StatIcons/Science"
     val Gold = "StatIcons/Gold"
-    val Death = "OtherIcons/DisbandUnit"
+    val Dehas ath = "OtherIcons/DisbandUnit"
     val Diplomacy = "OtherIcons/Diplomacy"
 }
 
diff --git a/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt b/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt
index 39bbd9031a..bda7edf62a 100644
--- a/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt
+++ b/core/src/com/unciv/ui/worldscreen/NotificationsScroll.kt
@@ -20,6 +20,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
     init {
         actor = notificationsTable.right()
         touchable = Touchable.childrenOnly
+        setScale(.5f)
     }
 
     internal fun update(notifications: MutableList<Notification>) {
@@ -49,7 +50,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
             }
             else if(notification.color!=null) listItem.add(ImageGetter.getCircle()
                     .apply { color = notification.color }).size(iconSize).padRight(5f)
-            listItem.background = ImageGetter.getRoundedEdgeTableBackground().apply { setScale(0.5f) }
+            listItem.background = ImageGetter.getRoundedEdgeTableBackground()
             listItem.add(label)
 
             // using a large click area with no gap in between each message item.
@@ -57,9 +58,7 @@ class NotificationsScroll(internal val worldScreen: WorldScreen) : ScrollPane(nu
             val clickArea = Table().apply {
                 add(listItem).pad(3f)
                 touchable = Touchable.enabled
-                onClick {
-                    notification.action?.execute(worldScreen)
-                }
+                onClick { notification.action?.execute(worldScreen) }
             }
 
             notificationsTable.add(clickArea).right().row()