Skip to content

Commit

Permalink
fix: lateinit property cityInfo has not been initialized issue. (#7739)
Browse files Browse the repository at this point in the history
* fix: lateinit property cityInfo has not been initialized issue.

* use loop instead of foreach.
  • Loading branch information
nacro711072 authored Sep 5, 2022
1 parent 313290c commit 7a1c025
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/src/com/unciv/logic/GameInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
for (religion in religions.values) religion.setTransients(this)

for (civInfo in civilizations) civInfo.setTransients()
for (civInfo in civilizations) {
civInfo.thingsToFocusOnForVictory =
civInfo.getPreferredVictoryTypeObject()?.getThingsToFocus(civInfo) ?: setOf()
}

convertFortify()

Expand Down
2 changes: 0 additions & 2 deletions core/src/com/unciv/logic/civilization/CivilizationInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,6 @@ class CivilizationInfo : IsPartOfGameInfoSerialization {

victoryManager.civInfo = this

thingsToFocusOnForVictory = getPreferredVictoryTypeObject()?.getThingsToFocus(this) ?: setOf()

for (cityInfo in cities) {
cityInfo.civInfo = this // must be before the city's setTransients because it depends on the tilemap, that comes from the currentPlayerCivInfo
cityInfo.setTransients()
Expand Down

0 comments on commit 7a1c025

Please sign in to comment.