Merge pull request #300 from ninjatao/allow_tranfer_tile

Allow city to acuqire nearby tiles from friendly cities.
This commit is contained in:
yairm210
2018-12-04 12:14:45 +02:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@ -84,7 +84,7 @@ class CityExpansionManager {
tileInfo.owningCity=null
}
private fun takeOwnership(tileInfo: TileInfo){
fun takeOwnership(tileInfo: TileInfo){
if(tileInfo.isCityCenter()) throw Exception("What?")
if(tileInfo.getCity()!=null) tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)

View File

@ -240,6 +240,13 @@ class CityScreen(internal val city: CityInfo) : CameraStageBaseScreen() {
if(goldCostOfTile>city.civInfo.gold) buyTileButton.disable()
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.setPosition(stage.width - 10f - tileTable.width, 10f)