mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-26 21:35:14 -04:00
Resolved #2638 - Auto-assign of population no longer "double books" tiles
This commit is contained in:
parent
0678e77487
commit
eb6a11cccb
@ -79,7 +79,7 @@ class PopulationManager {
|
||||
//evaluate tiles
|
||||
val bestTile: TileInfo? = cityInfo.getTiles()
|
||||
.filter { it.aerialDistanceTo(cityInfo.getCenterTile()) <= 3 }
|
||||
.filterNot { cityInfo.workedTiles.contains(it.position) || cityInfo.location==it.position}
|
||||
.filterNot { it.isWorked() || cityInfo.location == it.position }
|
||||
.maxBy { Automation.rankTileForCityWork(it, cityInfo, foodWeight) }
|
||||
val valueBestTile = if (bestTile == null) 0f
|
||||
else Automation.rankTileForCityWork(bestTile, cityInfo, foodWeight)
|
||||
@ -110,7 +110,7 @@ class PopulationManager {
|
||||
|
||||
fun unassignExtraPopulation() {
|
||||
for(tile in cityInfo.workedTiles.map { cityInfo.tileMap[it] }) {
|
||||
if (tile.getOwner() != cityInfo.civInfo)
|
||||
if (tile.getOwner() != cityInfo.civInfo || tile.getWorkingCity() != cityInfo)
|
||||
cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tile.position)
|
||||
if (tile.aerialDistanceTo(cityInfo.getCenterTile()) > 3)
|
||||
cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tile.position)
|
||||
|
@ -56,7 +56,8 @@ class Technology {
|
||||
lineList += " * " + wonder.name.tr() + " (" + wonder.getShortDescription(ruleset) + ")"
|
||||
}
|
||||
|
||||
val revealedResource = ruleset.tileResources.values.filter { it.revealedBy == name }.map { it.name }.firstOrNull() // can only be one
|
||||
val revealedResource = ruleset.tileResources.values.filter { it.revealedBy == name }
|
||||
.map { it.name }.firstOrNull() // can only be one
|
||||
if (revealedResource != null) lineList += "Reveals [$revealedResource] on the map".tr()
|
||||
|
||||
val tileImprovements = ruleset.tileImprovements.values.filter { it.techRequired == name }
|
||||
|
@ -53,7 +53,7 @@ class CityScreenTileTable(val cityScreen: CityScreen): Table(){
|
||||
|
||||
if(city.civInfo.cities.filterNot { it==city }
|
||||
.any { it.workedTiles.contains(selectedTile.position) }) {
|
||||
innerTable.add("Worked by [${selectedTile.getCity()!!.name}]".toLabel()).row()
|
||||
innerTable.add("Worked by [${selectedTile.getWorkingCity()!!.name}]".toLabel()).row()
|
||||
}
|
||||
|
||||
if(city.workedTiles.contains(selectedTile.position)){
|
||||
|
@ -39,8 +39,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
||||
baseLayerGroup.color.a = 0.5f
|
||||
}
|
||||
|
||||
city.civInfo.cities.filterNot { it == city } // worked by another city
|
||||
.any { it.workedTiles.contains(tileInfo.position) } -> {
|
||||
tileInfo.isWorked() && tileInfo.getWorkingCity()!=city -> {
|
||||
// Don't fade out, but don't add a population icon either.
|
||||
baseLayerGroup.color.a = 0.5f
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user