mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Fixed a crash in badly defined mods (#4598)
This commit is contained in:
parent
2971e6bba3
commit
54df4ba0c0
@ -779,6 +779,8 @@ class CivilizationInfo {
|
||||
val givingCityState = getKnownCivs().filter { it.isCityState() && it.getAllyCiv() == civName}.random()
|
||||
var giftableUnits = gameInfo.ruleSet.units.values.filter { it.isGreatPerson() }
|
||||
if (!gameInfo.hasReligionEnabled()) giftableUnits = giftableUnits.filterNot { it.uniques.contains("Great Person - [Faith]")}
|
||||
if (giftableUnits.isEmpty()) // For badly defined mods that don't have great people but do have the policy that makes city states grant them
|
||||
return
|
||||
val giftedUnit = giftableUnits.random()
|
||||
val cities = NextTurnAutomation.getClosestCities(this, givingCityState)
|
||||
val placedUnit = placeUnitNearTile(cities.city1.location, giftedUnit.name)
|
||||
|
Loading…
Reference in New Issue
Block a user