mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 23:04:25 +07:00
Treat mad modder divide by zero
This commit is contained in:
parent
9dc4cacc2b
commit
23f9ab9dac
@ -37,7 +37,8 @@ class TileImprovement : RulesetStatsObject() {
|
||||
val buildSpeedIncreases = unit.getMatchingUniques(UniqueType.ImprovementTimeIncrease, state, checkCivInfoUniques = true)
|
||||
.filter { matchesFilter(it.params[0], state) }
|
||||
val increase = buildSpeedIncreases.sumOf { it.params[1].toDouble() }.toFloat().toPercent()
|
||||
val buildTime = (civInfo.gameInfo.speed.improvementBuildLengthModifier * turnsToBuild / increase)
|
||||
val buildTime = if (increase == 0f) 0f
|
||||
else (civInfo.gameInfo.speed.improvementBuildLengthModifier * turnsToBuild / increase)
|
||||
|
||||
return buildSpeedUniques.fold(buildTime) { calculatedTurnsToBuild, unique ->
|
||||
calculatedTurnsToBuild * unique.params[0].toPercent()
|
||||
|
Loading…
Reference in New Issue
Block a user