mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 09:18:43 +07:00
Avoid modifying the ruleset object and unique stats (#11014)
This commit is contained in:
@ -38,7 +38,7 @@ class TileStatFunctions(val tile: Tile) {
|
|||||||
|
|
||||||
val percentageStats = getTilePercentageStats(observingCiv, city, localUniqueCache)
|
val percentageStats = getTilePercentageStats(observingCiv, city, localUniqueCache)
|
||||||
for (stats in statsBreakdown) {
|
for (stats in statsBreakdown) {
|
||||||
val tileType = when(stats.first) {
|
val tileType = when (stats.first) {
|
||||||
improvement -> "Improvement"
|
improvement -> "Improvement"
|
||||||
road.name -> "Road"
|
road.name -> "Road"
|
||||||
else -> "Terrain"
|
else -> "Terrain"
|
||||||
@ -125,7 +125,8 @@ class TileStatFunctions(val tile: Tile) {
|
|||||||
listOfStats.toStats().gold != 0f && observingCiv.goldenAges.isGoldenAge())
|
listOfStats.toStats().gold != 0f && observingCiv.goldenAges.isGoldenAge())
|
||||||
listOfStats.add("Golden Age" to Stats(gold = 1f))
|
listOfStats.add("Golden Age" to Stats(gold = 1f))
|
||||||
|
|
||||||
return listOfStats.filter { !it.second.isEmpty() }
|
// To ensure that the original stats (in uniques, terrains, etc) are not modified in getTileStats, we clone them all
|
||||||
|
return listOfStats.filter { !it.second.isEmpty() }.map { it.first to it.second.clone() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Ensures each stat is >= [other].stat - modifies in place */
|
/** Ensures each stat is >= [other].stat - modifies in place */
|
||||||
|
Reference in New Issue
Block a user