From e7653bd53d2cf1ec68a3478d0c6b4e46a2fe72f1 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 13 Apr 2023 17:51:11 +0300 Subject: [PATCH] Resolved #9163 - Can again spectate games where not an original participant --- core/src/com/unciv/logic/GameInfo.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index 11ffe231fd..853017a611 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -204,7 +204,8 @@ class GameInfo : IsPartOfGameInfoSerialization, HasGameInfoSerializationVersion val civMap by lazy { civilizations.associateBy { it.civName } } /** Get a civ by name * @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 getCivilizationsAsPreviews() = civilizations.map { it.asPreview() }.toMutableList() /** Get barbarian civ