From 84f7d4f56b88edc7061f6918a0b01d22fa549182 Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Sat, 4 Sep 2021 20:27:13 +0200 Subject: [PATCH] Fix map setTransients throwing exception from map generator on some map sizes (#5084) --- core/src/com/unciv/logic/map/TileMap.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index 888158d134..1e6edb7ea0 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -367,8 +367,8 @@ class TileMap { } } else { // Yes the map generator calls this repeatedly, and we don't want to end up with an oversized tileMatrix - // rightX is -leftX or -leftX + 1 - if (tileMatrix.size != 1 - 2 * leftX && tileMatrix.size != 2 - 2 * leftX) + // rightX is -leftX or -leftX + 1 or -leftX + 2 + if (tileMatrix.size !in (1 - 2 * leftX)..(3 - 2 * leftX)) throw(IllegalStateException("TileMap.setTransients called on existing tileMatrix of different size")) }