mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Fixed a few rare mod-specific crashes (#6070)
This commit is contained in:
parent
1b01ee3802
commit
599a09176d
@ -63,11 +63,12 @@ class PopulationManager {
|
|||||||
if (foodStored >= getFoodToNextPopulation()) { // growth!
|
if (foodStored >= getFoodToNextPopulation()) { // growth!
|
||||||
foodStored -= getFoodToNextPopulation()
|
foodStored -= getFoodToNextPopulation()
|
||||||
var percentOfFoodCarriedOver =
|
var percentOfFoodCarriedOver =
|
||||||
(cityInfo.getMatchingUniques(UniqueType.CarryOverFood)
|
(
|
||||||
|
(cityInfo.getMatchingUniques(UniqueType.CarryOverFood)
|
||||||
|
+ cityInfo.getMatchingUniques(UniqueType.CarryOverFoodAlsoDeprecated)
|
||||||
|
).filter { cityInfo.matchesFilter(it.params[1]) }
|
||||||
+ cityInfo.getMatchingUniques(UniqueType.CarryOverFoodDeprecated)
|
+ cityInfo.getMatchingUniques(UniqueType.CarryOverFoodDeprecated)
|
||||||
+ cityInfo.getMatchingUniques(UniqueType.CarryOverFoodAlsoDeprecated)
|
).sumOf { it.params[0].toInt() }
|
||||||
).filter { cityInfo.matchesFilter(it.params[1]) }
|
|
||||||
.sumOf { it.params[0].toInt() }
|
|
||||||
// Try to avoid runaway food gain in mods, just in case
|
// Try to avoid runaway food gain in mods, just in case
|
||||||
if (percentOfFoodCarriedOver > 95) percentOfFoodCarriedOver = 95
|
if (percentOfFoodCarriedOver > 95) percentOfFoodCarriedOver = 95
|
||||||
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
foodStored += (getFoodToNextPopulation() * percentOfFoodCarriedOver / 100f).toInt()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.unciv.logic.civilization
|
package com.unciv.logic.civilization
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.GameInfo
|
import com.unciv.logic.GameInfo
|
||||||
import com.unciv.logic.UncivShowableException
|
import com.unciv.logic.UncivShowableException
|
||||||
@ -965,6 +966,11 @@ class CivilizationInfo {
|
|||||||
shouldShowDiplomaticVotingResults()
|
shouldShowDiplomaticVotingResults()
|
||||||
|
|
||||||
private fun updateRevolts() {
|
private fun updateRevolts() {
|
||||||
|
if (gameInfo.civilizations.none { it.civName == Constants.barbarians }) {
|
||||||
|
// Can't spawn revolts without barbarians ¯\_(ツ)_/¯
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasUnique(UniqueType.SpawnRebels)) {
|
if (!hasUnique(UniqueType.SpawnRebels)) {
|
||||||
removeFlag(CivFlags.RevoltSpawning.name)
|
removeFlag(CivFlags.RevoltSpawning.name)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user