mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Remove cache for nonstandard tile damage (#11080)
This commit is contained in:
parent
10f3781e6f
commit
bfc18f53d8
@ -125,10 +125,6 @@ class Civilization : IsPartOfGameInfoSerialization {
|
|||||||
@Transient
|
@Transient
|
||||||
var passThroughImpassableUnlocked = false // Cached Boolean equal to passableImpassables.isNotEmpty()
|
var passThroughImpassableUnlocked = false // Cached Boolean equal to passableImpassables.isNotEmpty()
|
||||||
|
|
||||||
@Transient
|
|
||||||
var nonStandardTerrainDamage = false
|
|
||||||
|
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
var thingsToFocusOnForVictory = setOf<Victory.Focus>()
|
var thingsToFocusOnForVictory = setOf<Victory.Focus>()
|
||||||
|
|
||||||
@ -701,9 +697,6 @@ class Civilization : IsPartOfGameInfoSerialization {
|
|||||||
city.workedTiles.remove(workedTile)
|
city.workedTiles.remove(workedTile)
|
||||||
|
|
||||||
passThroughImpassableUnlocked = passableImpassables.isNotEmpty()
|
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)
|
hasLongCountDisplayUnique = hasUnique(UniqueType.MayanCalendarDisplay)
|
||||||
|
|
||||||
|
@ -485,14 +485,6 @@ class MapUnit : IsPartOfGameInfoSerialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getDamageFromTerrain(tile: Tile = currentTile): Int {
|
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 }
|
return tile.allTerrains.sumOf { it.damagePerTurn }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user