Avoid addGreatPerson exception.

This commit is contained in:
Duan Tao 2018-12-27 10:58:50 +08:00
parent 2575ffd01f
commit 0e77d5b044

View File

@ -350,11 +350,15 @@ class CivilizationInfo {
city.endTurn()
}
val greatPerson = greatPeople.getNewGreatPerson()
if (greatPerson != null) {
addGreatPerson(greatPerson)
//if no city available, addGreatPerson will throw exception
if (!cities.isNotEmpty()) {
val greatPerson = greatPeople.getNewGreatPerson()
if (greatPerson != null) {
addGreatPerson(greatPerson)
}
}
goldenAges.endTurn(happiness)
getCivUnits().forEach { it.endTurn() }
diplomacy.values.forEach{it.nextTurn()}