1
0
mirror of https://github.com/yairm210/Unciv.git synced 2025-01-13 00:04:38 +07:00

Fix new improvements becoming visible on non-observed tiles ()

This commit is contained in:
SomeTroglodyte 2024-08-03 22:19:10 +02:00 committed by GitHub
parent 3a969e59e3
commit 094ef672b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -321,7 +321,15 @@ class Tile : IsPartOfGameInfoSerialization, Json.Serializable {
else ruleset.tileImprovements[getUnpillagedRoad().name]
}
fun getShownImprovement(viewingCiv: Civilization?): String? = viewingCiv?.getLastSeenImprovement(position) ?: improvement
/**
* Improvement to display, accounting for knowledge about a Tile possibly getting stale when a human player is no longer actively watching it.
* Relies on a Civilization's lastSeenImprovement always being up to date while the civ can see the Tile.
* @param viewingCiv `null` means civ-agnostic and thus always showing the actual improvement
* @return The improvement name, or `null` if no improvement should be shown
*/
fun getShownImprovement(viewingCiv: Civilization?): String? =
if (viewingCiv == null || viewingCiv.playerType == PlayerType.AI || viewingCiv.isSpectator()) improvement
else viewingCiv.getLastSeenImprovement(position)
/** Returns true if this tile has fallout or an equivalent terrain feature */
fun hasFalloutEquivalent(): Boolean = terrainFeatures.any { ruleset.terrains[it]!!.hasUnique(UniqueType.NullifyYields)}