diff --git a/android/assets/OtherIcons/Crosshair.png b/android/assets/OtherIcons/Crosshair.png new file mode 100644 index 0000000000..bf35e244da Binary files /dev/null and b/android/assets/OtherIcons/Crosshair.png differ diff --git a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt index 580ae49b8d..8471314e56 100644 --- a/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt +++ b/core/src/com/unciv/logic/map/UnitMovementAlgorithms.kt @@ -40,7 +40,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) { val isOwnedByEnemy = neighborOwner!=null && neighborOwner!=unit.civInfo if ((isOwnedByEnemy && neighbor.isCityCenter())// Enemy city, || (neighbor.getUnits().isNotEmpty() && neighbor.getUnits().first().civInfo!=unit.civInfo) // Enemy unit - || (isOwnedByEnemy && !unit.civInfo.canEnterTiles(neighborOwner!!)) + || (isOwnedByEnemy && !unit.civInfo.canEnterTiles(neighborOwner!!)) // enemyTile ) totalDistanceToTile = unitMovement // Can't go here. // The reason that we don't just "return" is so that when calculating how to reach an enemy, diff --git a/core/src/com/unciv/ui/tilegroups/TileGroup.kt b/core/src/com/unciv/ui/tilegroups/TileGroup.kt index 83e29772a0..db909bdc99 100644 --- a/core/src/com/unciv/ui/tilegroups/TileGroup.kt +++ b/core/src/com/unciv/ui/tilegroups/TileGroup.kt @@ -27,6 +27,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { protected var civilianUnitImage: Group? = null protected var militaryUnitImage: Group? = null private val circleImage = ImageGetter.getImage("OtherIcons/Circle.png") // for blue and red circles on the tile + private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for blue and red circles on the tile private val fogImage = ImageGetter.getImage("TerrainIcons/Fog.png") var yieldGroup = YieldGroup() @@ -41,6 +42,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { addHexagon(groupSize) addCircleImage() addFogImage() + addCrosshairImage() } private fun addCircleImage() { @@ -59,6 +61,19 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { addActor(fogImage) } + private fun addCrosshairImage(){ + crosshairImage.width=70f + crosshairImage.height=70f + crosshairImage.center(this) + crosshairImage.isVisible=false + crosshairImage.color= Color.WHITE.cpy().apply { a=0.5f } + addActor(crosshairImage) + } + + fun showCrosshair(){ + crosshairImage.isVisible=true + } + private fun addHexagon(groupSize: Float) { val imageScale = groupSize * 1.5f / hexagon.width hexagon.setScale(imageScale) @@ -107,6 +122,9 @@ open class TileGroup(var tileInfo: TileInfo) : Group() { updateRoadImages() updateBorderImages() + crosshairImage.toFront() + crosshairImage.isVisible=false + fogImage.toFront() fogImage.isVisible=!(isViewable || UnCivGame.Current.viewEntireMapForDebug) } diff --git a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt index ed4f10d66e..59b3cbb641 100644 --- a/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/TileMapHolder.kt @@ -96,7 +96,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: if((playerViewableTiles.contains(WG.tileInfo) || UnCivGame.Current.viewEntireMapForDebug) && unitsInTile.isNotEmpty() && unitsInTile.first().civInfo!=civInfo) WG.showCircle(Color.RED) - } // Display ALL viewable enemies ewith a red circle so that users don't need to go "hunting" for enemy units + } // Display ALL viewable enemies with a red circle so that users don't need to go "hunting" for enemy units if(worldScreen.bottomBar.unitTable.selectedUnit!=null){ val unit = worldScreen.bottomBar.unitTable.selectedUnit!! @@ -118,7 +118,10 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap: && it.getUnits().first().owner != unit.owner && (playerViewableTiles.contains(it) || UnCivGame.Current.viewEntireMapForDebug)}) { if(unit.getBaseUnit().unitType== UnitType.Civilian) tileGroups[tile]!!.hideCircle() - else tileGroups[tile]!!.showCircle(colorFromRGB(237, 41, 57)) + else { + tileGroups[tile]!!.showCircle(colorFromRGB(237, 41, 57)) + tileGroups[tile]!!.showCrosshair() + } } }