mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +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:
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.remove(tileInfo.position)
|
||||||
|
|
||||||
cityInfo.tiles.add(tileInfo.position)
|
cityInfo.tiles.add(tileInfo.position)
|
||||||
|
for(unit in tileInfo.getUnits())
|
||||||
|
if(!unit.civInfo.canEnterTiles(cityInfo.civInfo))
|
||||||
|
unit.movementAlgs().teleportToClosestMoveableTile()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNewTile(): TileInfo? {
|
fun getNewTile(): TileInfo? {
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.unciv.logic.map
|
package com.unciv.logic.map
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector2
|
import com.badlogic.gdx.math.Vector2
|
||||||
import com.unciv.models.gamebasics.unit.UnitType
|
|
||||||
|
|
||||||
class UnitMovementAlgorithms(val unit:MapUnit) {
|
class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||||
val tileMap = unit.getTile().tileMap
|
val tileMap = unit.getTile().tileMap
|
||||||
@ -185,9 +184,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
|||||||
.firstOrNull{unit.canMoveTo(it)}
|
.firstOrNull{unit.canMoveTo(it)}
|
||||||
}
|
}
|
||||||
unit.removeFromTile() // we "teleport" them away
|
unit.removeFromTile() // we "teleport" them away
|
||||||
if(unit.getBaseUnit().unitType==UnitType.Civilian)
|
unit.putInTile(allowedTile)
|
||||||
allowedTile.civilianUnit=unit
|
|
||||||
else allowedTile.militaryUnit=unit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user