Fixed crashes caused by 'healing on friendly tile' checks to unmet civs for barbarians

This commit is contained in:
Yair Morgenstern 2020-02-03 16:13:32 +02:00
parent a73fe3d9de
commit 24c3bdc564

View file

@ -398,10 +398,12 @@ class MapUnit {
/** Returns the health points [MapUnit] will receive if healing on [tileInfo] */
fun rankTileForHealing(tileInfo: TileInfo): Int {
val tileOwner = tileInfo.getOwner()
val isAlliedTerritory = if (tileOwner != null)
tileOwner == civInfo || tileOwner.getDiplomacyManager(civInfo).isConsideredAllyTerritory()
else
false
val isAlliedTerritory = when {
tileOwner == null -> false
tileOwner == civInfo -> true
!civInfo.knows(tileOwner) -> false
else -> tileOwner.getDiplomacyManager(civInfo).isConsideredAllyTerritory()
}
var healing = when {
tileInfo.isCityCenter() -> 20