diff --git a/core/src/com/unciv/logic/map/TileMap.kt b/core/src/com/unciv/logic/map/TileMap.kt index 43a0fbf4fc..42fd994e5e 100644 --- a/core/src/com/unciv/logic/map/TileMap.kt +++ b/core/src/com/unciv/logic/map/TileMap.kt @@ -214,6 +214,9 @@ class TileMap(initialCapacity: Int = 10) : IsPartOfGameInfoSerialization { //endregion //region Pure Functions + /** Can we access [gameInfo]? e.g. for MapEditor use where there is a map but no game */ + fun hasGameInfo() = ::gameInfo.isInitialized + /** @return All tiles in a hexagon of radius [distance], including the tile at [origin] and all up to [distance] steps away. * Respects map edges and world wrap. */ fun getTilesInDistance(origin: Vector2, distance: Int): Sequence = diff --git a/core/src/com/unciv/logic/map/tile/TileImprovementFunctions.kt b/core/src/com/unciv/logic/map/tile/TileImprovementFunctions.kt index d05e05aa4a..cf8e8afff9 100644 --- a/core/src/com/unciv/logic/map/tile/TileImprovementFunctions.kt +++ b/core/src/com/unciv/logic/map/tile/TileImprovementFunctions.kt @@ -217,7 +217,8 @@ class TileImprovementFunctions(val tile: Tile) { } } - if (improvementFieldHasChanged) { + if (improvementFieldHasChanged && tile.tileMap.hasGameInfo()) { + // Update the separately-kept "what a civ sees" - unless in map editor where there are no civs for (civ in tile.tileMap.gameInfo.civilizations) { if (civ.isDefeated() || !civ.isMajorCiv()) continue if (civ == civToActivateBroaderEffects || tile.isVisible(civ))