Don't reveal submarine position by city markers (#2643)
This commit is contained in:
parent
4b405ecc61
commit
98a4c8bf00
3 changed files with 4 additions and 4 deletions
|
@ -435,7 +435,7 @@ open class TileInfo {
|
|||
turnsToImprovement = 0
|
||||
}
|
||||
|
||||
fun hasEnemySubmarine(viewingCiv: CivilizationInfo): Boolean {
|
||||
fun hasEnemyInvisibleUnit(viewingCiv: CivilizationInfo): Boolean {
|
||||
val unitsInTile = getUnits()
|
||||
if (unitsInTile.none()) return false
|
||||
if (unitsInTile.first().civInfo != viewingCiv &&
|
||||
|
|
|
@ -77,13 +77,13 @@ class CityButton(val city: CityInfo, private val tileGroup: WorldTileGroup): Tab
|
|||
(tile.civilianUnit != null) && direction.epsilonEquals(0f, 1f) ->
|
||||
insertHiddenUnitMarker(HiddenUnitMarkerPosition.Left)
|
||||
// detect military under the city
|
||||
(tile.militaryUnit != null) && direction.epsilonEquals(1f, 1f) ->
|
||||
(tile.militaryUnit != null && !tile.hasEnemyInvisibleUnit(worldScreen.viewingCiv)) && direction.epsilonEquals(1f, 1f) ->
|
||||
insertHiddenUnitMarker(HiddenUnitMarkerPosition.Center)
|
||||
// detect civilian right-below the city
|
||||
(tile.civilianUnit != null) && direction.epsilonEquals(1f, 0f) ->
|
||||
insertHiddenUnitMarker(HiddenUnitMarkerPosition.Right)
|
||||
}
|
||||
} else if (tile.militaryUnit != null) {
|
||||
} else if (tile.militaryUnit != null && !tile.hasEnemyInvisibleUnit(worldScreen.viewingCiv)) {
|
||||
when {
|
||||
// detect military left from the city
|
||||
direction.epsilonEquals(0f, 1f) ->
|
||||
|
|
|
@ -269,7 +269,7 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
|||
|
||||
fun showMilitaryUnit(viewingCiv: CivilizationInfo) = showEntireMap
|
||||
|| viewingCiv.viewableInvisibleUnitsTiles.contains(tileInfo)
|
||||
|| !tileInfo.hasEnemySubmarine(viewingCiv)
|
||||
|| !tileInfo.hasEnemyInvisibleUnit(viewingCiv)
|
||||
|
||||
fun isViewable(viewingCiv: CivilizationInfo) = showEntireMap
|
||||
|| viewingCiv.viewableTiles.contains(tileInfo)
|
||||
|
|
Loading…
Reference in a new issue