Cities now only take ownership of _unowned_ tiles around them

This commit is contained in:
Yair Morgenstern 2019-04-01 22:38:36 +03:00
parent 9a72623499
commit 89a720f7b2
3 changed files with 8 additions and 5 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 221
versionName "2.14.2"
versionCode 223
versionName "2.14.3"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View File

@ -76,7 +76,9 @@ class CityExpansionManager {
for(tile in cityInfo.tiles.map { cityInfo.tileMap[it] })
relinquishOwnership(tile)
cityInfo.getCenterTile().getTilesInDistance(1).forEach { takeOwnership(it) }
cityInfo.getCenterTile().getTilesInDistance(1)
.filter { it.getCity()!=null } // can't take ownership of owned tiles
.forEach { takeOwnership(it) }
}
private fun addNewTileWithCulture() {
@ -97,7 +99,8 @@ class CityExpansionManager {
fun takeOwnership(tileInfo: TileInfo){
if(tileInfo.isCityCenter()) throw Exception("What?!")
if(tileInfo.getCity()!=null) tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)
if(tileInfo.getCity()!=null)
tileInfo.getCity()!!.expansion.relinquishOwnership(tileInfo)
cityInfo.tiles = cityInfo.tiles.withItem(tileInfo.position)
tileInfo.owningCity = cityInfo

View File

@ -43,7 +43,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
else {
pickProductionButton.color = Color.GRAY
pickProductionButton.row()
pickProductionButton.add(rejectionReason.toLabel().setFontColor(Color.RED))
pickProductionButton.add(rejectionReason.toLabel().setFontColor(Color.RED)).colspan(pickProductionButton.columns)
}
if(construction==cityScreen.city.cityConstructions.currentConstruction)