Remove cache for nonstandard tile damage (#11080)

This commit is contained in:
SeventhM 2024-02-05 13:53:52 -08:00 committed by GitHub
parent 10f3781e6f
commit bfc18f53d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 15 deletions

View File

@ -125,10 +125,6 @@ class Civilization : IsPartOfGameInfoSerialization {
@Transient
var passThroughImpassableUnlocked = false // Cached Boolean equal to passableImpassables.isNotEmpty()
@Transient
var nonStandardTerrainDamage = false
@Transient
var thingsToFocusOnForVictory = setOf<Victory.Focus>()
@ -701,9 +697,6 @@ class Civilization : IsPartOfGameInfoSerialization {
city.workedTiles.remove(workedTile)
passThroughImpassableUnlocked = passableImpassables.isNotEmpty()
// Cache whether this civ gets nonstandard terrain damage for performance reasons.
nonStandardTerrainDamage = getMatchingUniques(UniqueType.DamagesContainingUnits)
.any { gameInfo.ruleset.terrains[it.params[0]]!!.damagePerTurn != it.params[1].toInt() }
hasLongCountDisplayUnique = hasUnique(UniqueType.MayanCalendarDisplay)

View File

@ -485,14 +485,6 @@ class MapUnit : IsPartOfGameInfoSerialization {
}
fun getDamageFromTerrain(tile: Tile = currentTile): Int {
if (civ.nonStandardTerrainDamage) {
for (unique in getMatchingUniques(UniqueType.DamagesContainingUnits)) {
if (unique.params[0] in tile.allTerrains.map { it.name }) {
return unique.params[1].toInt() // Use the damage from the unique
}
}
}
// Otherwise fall back to the defined standard damage
return tile.allTerrains.sumOf { it.damagePerTurn }
}