Fixed unit icons not getting deleted when unit exits tile

This commit is contained in:
Yair Morgenstern 2020-11-23 19:20:23 +02:00
parent 0952a6a5a6
commit 101fa9903e

View File

@ -53,6 +53,7 @@ class TileGroupIcons(val tileGroup: TileGroup){
fun newUnitIcon(unit: MapUnit?, oldUnitGroup: UnitGroup?, isViewable: Boolean, yFromCenter: Float, viewingCiv: CivilizationInfo?): UnitGroup? {
var newImage: UnitGroup? = null
// The unit can change within one update - for instance, when attacking, the attacker replaces the defender!
oldUnitGroup?.unitBaseImage?.remove()
oldUnitGroup?.remove()
if (unit != null && isViewable) { // Tile is visible