mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 19:39:34 +07:00
When cities expand, units that aren't allowed to enter there are pushed to the closest moveable tile
This commit is contained in:
parent
4a35d2f3db
commit
4c0372a8b5
Binary file not shown.
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 849 KiB After Width: | Height: | Size: 850 KiB |
@ -43,6 +43,9 @@ class CityExpansionManager {
|
||||
cityInfo.tiles.remove(tileInfo.position)
|
||||
|
||||
cityInfo.tiles.add(tileInfo.position)
|
||||
for(unit in tileInfo.getUnits())
|
||||
if(!unit.civInfo.canEnterTiles(cityInfo.civInfo))
|
||||
unit.movementAlgs().teleportToClosestMoveableTile()
|
||||
}
|
||||
|
||||
fun getNewTile(): TileInfo? {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.unciv.logic.map
|
||||
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.unciv.models.gamebasics.unit.UnitType
|
||||
|
||||
class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
val tileMap = unit.getTile().tileMap
|
||||
@ -185,9 +184,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
.firstOrNull{unit.canMoveTo(it)}
|
||||
}
|
||||
unit.removeFromTile() // we "teleport" them away
|
||||
if(unit.getBaseUnit().unitType==UnitType.Civilian)
|
||||
allowedTile.civilianUnit=unit
|
||||
else allowedTile.militaryUnit=unit
|
||||
unit.putInTile(allowedTile)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user