mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-07 14:02:48 +07:00
Fixed bug where cities would not "recognize" tiles on the first turn
This commit is contained in:
parent
f0cf29e6b9
commit
75f4301004
@ -33,14 +33,14 @@ 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
|
||||
fun getCityResources(): Counter<TileResource> {
|
||||
val cityResources = Counter<TileResource>()
|
||||
|
||||
for (tileInfo in getTilesInRange().filter { it.resource != null }) {
|
||||
for (tileInfo in getTiles().filter { it.resource != null }) {
|
||||
val resource = tileInfo.tileResource
|
||||
if (resource.improvement == tileInfo.improvement || tileInfo.isCityCenter())
|
||||
cityResources.add(resource, 1)
|
||||
@ -77,7 +77,6 @@ class CityInfo {
|
||||
|
||||
|
||||
constructor(civInfo: CivilizationInfo, cityLocation: Vector2) {
|
||||
|
||||
this.civInfo = civInfo
|
||||
setTransients()
|
||||
|
||||
@ -94,7 +93,6 @@ class CityInfo {
|
||||
|
||||
expansion.reset()
|
||||
|
||||
|
||||
val tile = getCenterTile()
|
||||
tile.roadStatus = RoadStatus.Railroad
|
||||
if (listOf("Forest", "Jungle", "Marsh").contains(tile.terrainFeature))
|
||||
|
@ -151,9 +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
|
||||
}
|
||||
if (!containsResourceWithImprovement) return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user