From 7afffe3a89d5d8ae65f3aa518b033a92a336580b Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Mon, 23 Aug 2021 19:18:54 +0200 Subject: [PATCH] getLastTerrain simple patch (#4971) --- core/src/com/unciv/logic/map/TileInfo.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/map/TileInfo.kt b/core/src/com/unciv/logic/map/TileInfo.kt index cb3eae889a..232e55cc57 100644 --- a/core/src/com/unciv/logic/map/TileInfo.kt +++ b/core/src/com/unciv/logic/map/TileInfo.kt @@ -135,7 +135,8 @@ open class TileInfo { fun getCity(): CityInfo? = owningCity fun getLastTerrain(): Terrain = when { - terrainFeatures.isNotEmpty() -> getTerrainFeatures().last() + terrainFeatures.isNotEmpty() -> ruleset.terrains[terrainFeatures.last()] + ?: getBaseTerrain() // defense against rare edge cases involving baseTerrain Hill deprecation naturalWonder != null -> getNaturalWonder() else -> getBaseTerrain() }