mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-15 04:14:44 +07:00
Resolved #9163 - Can again spectate games where not an original participant
This commit is contained in:
parent
2fbd24231f
commit
e7653bd53d
@ -204,7 +204,8 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion
|
|||||||
val civMap by lazy { civilizations.associateBy { it.civName } }
|
val civMap by lazy { civilizations.associateBy { it.civName } }
|
||||||
/** Get a civ by name
|
/** Get a civ by name
|
||||||
* @throws NoSuchElementException if no civ of that name is in the game (alive or dead)! */
|
* @throws NoSuchElementException if no civ of that name is in the game (alive or dead)! */
|
||||||
fun getCivilization(civName: String) = civMap.getValue(civName)
|
fun getCivilization(civName: String) = civMap[civName]
|
||||||
|
?: civilizations.first { it.civName == civName } // This is for spectators who are added in later, artificially
|
||||||
fun getCurrentPlayerCivilization() = currentPlayerCiv
|
fun getCurrentPlayerCivilization() = currentPlayerCiv
|
||||||
fun getCivilizationsAsPreviews() = civilizations.map { it.asPreview() }.toMutableList()
|
fun getCivilizationsAsPreviews() = civilizations.map { it.asPreview() }.toMutableList()
|
||||||
/** Get barbarian civ
|
/** Get barbarian civ
|
||||||
|
Loading…
Reference in New Issue
Block a user