mirror of
https://github.com/yairm210/Unciv.git
synced 2025-10-01 07:51:53 -04:00
Merge pull request #300 from ninjatao/allow_tranfer_tile
Allow city to acuqire nearby tiles from friendly cities.
This commit is contained in:
commit
a2a2c2ca00
@ -84,7 +84,7 @@ class CityExpansionManager {
|
|||||||
tileInfo.owningCity=null
|
tileInfo.owningCity=null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun takeOwnership(tileInfo: TileInfo){
|
fun takeOwnership(tileInfo: TileInfo){
|
||||||
if(tileInfo.isCityCenter()) throw Exception("What?")
|
if(tileInfo.isCityCenter()) throw Exception("What?")
|
||||||
if(tileInfo.getCity()!=null) tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)
|
if(tileInfo.getCity()!=null) tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)
|
||||||
|
|
||||||
|
@ -240,6 +240,13 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
|
|||||||
if(goldCostOfTile>city.civInfo.gold) buyTileButton.disable()
|
if(goldCostOfTile>city.civInfo.gold) buyTileButton.disable()
|
||||||
tileTable.add(buyTileButton)
|
tileTable.add(buyTileButton)
|
||||||
}
|
}
|
||||||
|
if(tile.getOwner()!=null && tile.getOwner()!!.isPlayerCivilization()
|
||||||
|
&& tile.arialDistanceTo(city.getCenterTile()) <= 3
|
||||||
|
&& tile.neighbors.any{it.getCity()==city}){
|
||||||
|
val acquireTileButton = TextButton("Acquire".tr(),skin)
|
||||||
|
acquireTileButton.onClick { city.expansion.takeOwnership(tile); game.screen = CityScreen(city); dispose() }
|
||||||
|
tileTable.add(acquireTileButton)
|
||||||
|
}
|
||||||
|
|
||||||
tileTable.pack()
|
tileTable.pack()
|
||||||
tileTable.setPosition(stage.width - 10f - tileTable.width, 10f)
|
tileTable.setPosition(stage.width - 10f - tileTable.width, 10f)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user