The "Construct improvement" action is now disabled when the unit has no movement or there are no improvements to pick

This commit is contained in:
Yair Morgenstern 2018-05-25 13:04:31 +03:00
parent 1a2d3d4421
commit c984704af1
4 changed files with 11 additions and 5 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 63
versionName "2.2.4"
versionCode 64
versionName "2.2.5"
}
buildTypes {
release {

View File

@ -30,7 +30,11 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
if (!tileInfo.canBuildImprovement(improvement, civInfo) || improvement.name == tileInfo.improvement) continue
val improvementButton = Button(skin)
improvementButton.add(ImageGetter.getImprovementIcon(improvement.name)).size(30f).pad(10f)
if(improvement.name.startsWith("Remove"))
improvementButton.add(ImageGetter.getImage("OtherIcons/Stop.png")).size(30f).pad(10f)
else improvementButton.add(ImageGetter.getImprovementIcon(improvement.name)).size(30f).pad(10f)
improvementButton.add(Label(improvement.name + " - " + improvement.getTurnsToBuild(civInfo) + " turns",skin)
.setFontColor(Color.WHITE)).pad(10f)

View File

@ -31,6 +31,7 @@ object ImageGetter {
textureRegionByFileName[fileName] = TextureRegion(texture)
}
} catch (ex: Exception) {
return getTextureRegion(WhiteDot)
throw Exception("File $fileName not found!",ex)
}

View File

@ -64,8 +64,9 @@ class UnitActions {
if (unit.name == "Worker") {
actionList += UnitAction("Construct improvement",
{ worldScreen.game.screen = ImprovementPickerScreen(tile) },
unit.currentMovement != 0f &&
!tile.isCityCenter() || GameBasics.TileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) })
unit.currentMovement != 0f
&& !tile.isCityCenter()
&& GameBasics.TileImprovements.values.any { tile.canBuildImprovement(it, unit.civInfo) })
if("automation" == unit.action){
actionList += UnitAction("Stop automation",