Resolved #2864 - Locks on tiles are removed when the tile is no longer under your control

This commit is contained in:
Yair Morgenstern 2020-07-23 14:17:41 +03:00
parent 1a558a70d2
commit 3f44e1c519
3 changed files with 15 additions and 12 deletions

View file

@ -108,8 +108,15 @@ class CityExpansionManager {
fun relinquishOwnership(tileInfo: TileInfo) { fun relinquishOwnership(tileInfo: TileInfo) {
cityInfo.tiles = cityInfo.tiles.withoutItem(tileInfo.position) cityInfo.tiles = cityInfo.tiles.withoutItem(tileInfo.position)
if (cityInfo.workedTiles.contains(tileInfo.position)) for (city in cityInfo.civInfo.cities) {
cityInfo.workedTiles = cityInfo.workedTiles.withoutItem(tileInfo.position) if (city.workedTiles.contains(tileInfo.position)) {
city.workedTiles = city.workedTiles.withoutItem(tileInfo.position)
city.population.autoAssignPopulation()
}
if (city.lockedTiles.contains(tileInfo.position))
city.lockedTiles.remove(tileInfo.position)
}
tileInfo.owningCity = null tileInfo.owningCity = null
cityInfo.civInfo.updateDetailedCivResources() cityInfo.civInfo.updateDetailedCivResources()

View file

@ -101,11 +101,7 @@ class PopulationManager {
if (valueBestTile > valueBestSpecialist) { if (valueBestTile > valueBestSpecialist) {
if (bestTile != null) if (bestTile != null)
cityInfo.workedTiles = cityInfo.workedTiles.withItem(bestTile.position) cityInfo.workedTiles = cityInfo.workedTiles.withItem(bestTile.position)
} else { } else if (bestJob != null) specialists.add(bestJob, 1f)
if (bestJob != null) {
specialists.add(bestJob, 1f)
}
}
} }
fun unassignExtraPopulation() { fun unassignExtraPopulation() {