From 7c1e0c0d2598bfb4af12386a3979d8677d347d8a Mon Sep 17 00:00:00 2001 From: yairm210 Date: Tue, 9 Jul 2024 23:28:18 +0300 Subject: [PATCH] chore: renames --- .../tilegroups/layers/TileLayerUnitArt.kt | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerUnitArt.kt b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerUnitArt.kt index caa455deb4..cb8329029b 100644 --- a/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerUnitArt.kt +++ b/core/src/com/unciv/ui/components/tilegroups/layers/TileLayerUnitArt.kt @@ -18,12 +18,12 @@ class TileLayerUnitArt(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, override fun act(delta: Float) {} override fun hit(x: Float, y: Float, touchable: Boolean): Actor? = null - private var slot1: UnitArtSlot = UnitArtSlot() - private var slot2: UnitArtSlot = UnitArtSlot() + private var civilianSlot: UnitArtSlot = UnitArtSlot() + private var militarySlot: UnitArtSlot = UnitArtSlot() init { - addActor(slot1) - addActor(slot2) + addActor(civilianSlot) + addActor(militarySlot) } private fun showMilitaryUnit(viewingCiv: Civilization) = tileGroup.isForceVisible @@ -66,29 +66,26 @@ class TileLayerUnitArt(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, override fun doUpdate(viewingCiv: Civilization?, localUniqueCache: LocalUniqueCache) { - val slot1Unit = tileGroup.tile.civilianUnit - val slot2Unit = tileGroup.tile.militaryUnit - val isPixelUnitsEnabled = UncivGame.Current.settings.showPixelUnits val isViewable = viewingCiv == null || isViewable(viewingCiv) val isVisibleMilitary = viewingCiv == null || showMilitaryUnit(viewingCiv) - val isSlot1Shown = isPixelUnitsEnabled && isViewable - val isSlot2Shown = isPixelUnitsEnabled && isViewable && isVisibleMilitary + val isCivilianSlotShown = isPixelUnitsEnabled && isViewable + val isMilitarySlotShown = isPixelUnitsEnabled && isViewable && isVisibleMilitary - updateSlot(slot1, slot1Unit, isShown = isSlot1Shown) - updateSlot(slot2, slot2Unit, isShown = isSlot2Shown) + updateSlot(civilianSlot, tileGroup.tile.civilianUnit, isShown = isCivilianSlotShown) + updateSlot(militarySlot, tileGroup.tile.militaryUnit, isShown = isMilitarySlotShown) } override fun determineVisibility() { - isVisible = slot1.hasChildren() || slot2.hasChildren() + isVisible = civilianSlot.hasChildren() || militarySlot.hasChildren() } fun reset() { - slot1.clear() - slot2.clear() + civilianSlot.clear() + militarySlot.clear() - slot1.imageLocation = "" - slot2.imageLocation = "" + civilianSlot.imageLocation = "" + militarySlot.imageLocation = "" } }