Fixed queue showing "Consumes 1" when no resource is consumed

Plus linting
This commit is contained in:
Yair Morgenstern 2021-02-07 19:13:10 +02:00
parent 5328efa233
commit 7d9b56e3b1
6 changed files with 29 additions and 32 deletions

View File

@ -39,7 +39,8 @@ open class TileInfo {
// This will be called often - farm can be built on Hill and tundra if adjacent to fresh water
// and farms on adjacent to fresh water tiles will have +1 additional Food after researching Civil Service
@delegate:Transient
val isAdjacentToFreshwater: Boolean by lazy { matchesUniqueFilter("River") || matchesUniqueFilter("Fresh water") || neighbors.any { it.matchesUniqueFilter("Fresh water") } }
val isAdjacentToFreshwater: Boolean by lazy { matchesUniqueFilter("River") || matchesUniqueFilter("Fresh water")
|| neighbors.any { it.matchesUniqueFilter("Fresh water") } }
var militaryUnit: MapUnit? = null
var civilianUnit: MapUnit? = null

View File

@ -76,8 +76,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
if (tileInfo.isWorked()) {
yieldGroup.color = Color.WHITE
}
else if(!tileInfo.isCityCenter()){
} else if (!tileInfo.isCityCenter()) {
yieldGroup.color = Color.GRAY.cpy().apply { a = 0.5f }
}
}
@ -89,12 +88,8 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
populationIcon.setPosition(width / 2 - populationIcon.width / 2,
height * 0.85f - populationIcon.height / 2)
if (tileInfo.isWorked()) {
populationIcon.color = Color.WHITE
}
else if(!tileInfo.isCityCenter()){
populationIcon.color = Color.GRAY.cpy()
}
if (tileInfo.isWorked()) populationIcon.color = Color.WHITE
else if (!tileInfo.isCityCenter()) populationIcon.color = Color.GRAY.cpy()
populationIcon.toFront()
}

View File

@ -16,6 +16,7 @@ import com.unciv.ui.utils.AutoScrollPane as ScrollPane
class ConstructionInfoTable(val city: CityInfo): Table() {
val selectedConstructionTable = Table()
init {
selectedConstructionTable.background = ImageGetter.getBackground(ImageGetter.getBlue().lerp(Color.BLACK, 0.5f))
add(selectedConstructionTable).pad(2f).fill()
@ -55,8 +56,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
val turnsToComplete = cityConstructions.turnsToConstruction(construction.name)
buildingText += ("\r\n" + "Cost".tr() + " " + construction.getProductionCost(city.civInfo).toString()).tr()
buildingText += turnOrTurns(turnsToComplete)
}
else {
} else {
buildingText += specialConstruction.getProductionTooltip(city)
}
selectedConstructionTable.add(buildingText.toLabel()).row()

View File

@ -228,9 +228,10 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
else turnOrTurns(turnsToComplete)
val constructionResource = cityConstructions.getConstruction(name).getResourceRequirements()
for ((resource, amount) in constructionResource)
if (amount == 1) text += "\n" + "Consumes 1 [$resource]".tr()
else text += "\n" + "Consumes [$amount] [$resource]".tr()
if (constructionResource != null)
text += "\n" + "Consumes 1 [$constructionResource]".tr()
table.defaults().pad(2f).minWidth(40f)
if (isFirstConstructionOfItsKind) table.add(getProgressBar(name)).minWidth(5f)