From e3fb00d93926213bdec9221c65ea7bf17b7b4990 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Tue, 28 Dec 2021 21:28:31 +0200 Subject: [PATCH] Resolved #5867 - fixed rare 'uninitialized continent sizes' bug --- core/src/com/unciv/logic/automation/Automation.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/automation/Automation.kt b/core/src/com/unciv/logic/automation/Automation.kt index b9cf5c9eac..1514c7be57 100644 --- a/core/src/com/unciv/logic/automation/Automation.kt +++ b/core/src/com/unciv/logic/automation/Automation.kt @@ -143,7 +143,7 @@ object Automation { return false var multiplier = if (civInfo.gameInfo.gameParameters.ragingBarbarians) 1.3f - else 1f // We're slightly more afraid of raging barbs + else 1f // We're slightly more afraid of raging barbs // Past the early game we are less afraid if (civInfo.gameInfo.turns > 120 * civInfo.gameInfo.gameParameters.gameSpeed.modifier * multiplier) @@ -156,7 +156,8 @@ object Automation { // If we have vision of our entire starting continent (ish) we are not afraid civInfo.gameInfo.tileMap.assignContinents(TileMap.AssignContinentsMode.Ensure) val startingContinent = civInfo.getCapital().getCenterTile().getContinent() - if (civInfo.gameInfo.tileMap.continentSizes[startingContinent]!! < civInfo.viewableTiles.count() * multiplier) + val startingContinentSize = civInfo.gameInfo.tileMap.continentSizes[startingContinent] + if (startingContinentSize != null && startingContinentSize < civInfo.viewableTiles.count() * multiplier) return false // Otherwise we're afraid