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() city.endTurn()
} }
val greatPerson = greatPeople.getNewGreatPerson() //if no city available, addGreatPerson will throw exception
if (greatPerson != null) { if (!cities.isNotEmpty()) {
addGreatPerson(greatPerson) val greatPerson = greatPeople.getNewGreatPerson()
if (greatPerson != null) {
addGreatPerson(greatPerson)
}
} }
goldenAges.endTurn(happiness) goldenAges.endTurn(happiness)
getCivUnits().forEach { it.endTurn() } getCivUnits().forEach { it.endTurn() }
diplomacy.values.forEach{it.nextTurn()} diplomacy.values.forEach{it.nextTurn()}