mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-23 03:23:17 -04:00
Fix map editor can't place improvements (#11743)
* Fix map editor can't place improvements * Prefer the 'has...' approach after all
This commit is contained in:
parent
294a0a71a4
commit
bb1057e515
@ -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<Tile> =
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user