Remove worked tiles when population starves (dead men work no tiles)
This commit is contained in:
parent
fd5aaaeee1
commit
c6e344b16e
2 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
fun getTilesInRange(): List<TileInfo> = getCenterTile().getTilesInDistance( 3).filter { civInfo == it.getOwner() }
|
||||
|
||||
|
||||
// Remove resources required by buildings
|
||||
|
|
|
@ -45,6 +45,10 @@ class PopulationManager {
|
|||
// starvation!
|
||||
{
|
||||
population--
|
||||
val lowestRankedWorkedTile = cityInfo.workedTiles
|
||||
.map{cityInfo.tileMap[it]}
|
||||
.minBy { Automation().rankTile(it,cityInfo.civInfo) }!!
|
||||
cityInfo.workedTiles.remove(lowestRankedWorkedTile.position)
|
||||
foodStored = 0
|
||||
cityInfo.civInfo.addNotification(cityInfo.name + " is starving!", cityInfo.location)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue