Fixed bug where cities would not "recognize" tiles on the first turn - for realz this time

This commit is contained in:
Yair Morgenstern 2018-05-06 11:24:39 +03:00
parent c6e344b16e
commit 5d4003ecbf
3 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ class CityInfo {
fun getCenterTile(): TileInfo = tileMap[location]
fun getTiles(): List<TileInfo> = tiles.map { tileMap[it] }
fun getTilesInRange(): List<TileInfo> = getCenterTile().getTilesInDistance( 3).filter { civInfo == it.getOwner() }
fun getTilesInRange(): List<TileInfo> = getCenterTile().getTilesInDistance( 3)
// Remove resources required by buildings
@ -92,6 +92,7 @@ class CityInfo {
}
expansion.reset()
civInfo.gameInfo.updateTilesToCities()
val tile = getCenterTile()
tile.roadStatus = RoadStatus.Railroad

View File

@ -151,10 +151,10 @@ class Building : NamedStats(), IConstruction, ICivilopedia {
if (requiredNearbyImprovedResources != null) {
val containsResourceWithImprovement = construction.cityInfo.getTilesInRange()
.any {
it.resource != null
it.resource != null
&& requiredNearbyImprovedResources!!.contains(it.resource!!)
&& it.tileResource.improvement == it.improvement
&& it.getOwner() == civInfo
&& it.getOwner() == civInfo
}
if (!containsResourceWithImprovement) return false
}

View File

@ -62,7 +62,6 @@ class UnitActions {
unit.civInfo.addCity(tile.position)
unitTable.currentlyExecutingAction = null // In case the settler was in the middle of doing something and we then founded a city with it
tile.unit = null // Remove settler!
unit.civInfo.gameInfo.updateTilesToCities()
},
unit.currentMovement != 0f &&
!tile.getTilesInDistance(2).any { it.isCityCenter() })