diff --git a/core/src/com/unciv/logic/city/IConstruction.kt b/core/src/com/unciv/logic/city/IConstruction.kt index 537cbb5af2..56a8338ffd 100644 --- a/core/src/com/unciv/logic/city/IConstruction.kt +++ b/core/src/com/unciv/logic/city/IConstruction.kt @@ -9,7 +9,7 @@ interface IConstruction : INamed { fun getProductionCost(civInfo: CivilizationInfo): Int fun getGoldCost(civInfo: CivilizationInfo): Int fun isBuildable(construction: CityConstructions): Boolean - fun shouldBeDisplayed(construction: CityConstructions): Boolean + fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean fun postBuildEvent(construction: CityConstructions, wasBought: Boolean = false): Boolean // Yes I'm hilarious. fun getResource(): String? fun canBePurchased(): Boolean @@ -18,8 +18,8 @@ interface IConstruction : INamed { open class PerpetualConstruction(override var name: String, val description: String) : IConstruction{ - override fun shouldBeDisplayed(construction: CityConstructions): Boolean { - return isBuildable(construction) + override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean { + return isBuildable(cityConstructions) } open fun getProductionTooltip(cityInfo: CityInfo) : String = "\r\n${(cityInfo.cityStats.currentCityStats.production / CONVERSION_RATE).roundToInt()}/${"{turn}".tr()}" diff --git a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt index 17cf07a31e..cdfc25718e 100644 --- a/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt +++ b/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt @@ -118,7 +118,9 @@ class BaseUnit : INamed, IConstruction { override fun shouldBeDisplayed(construction: CityConstructions): Boolean { val rejectionReason = getRejectionReason(construction) - return rejectionReason=="" || rejectionReason.startsWith("Requires") + return rejectionReason=="" + || rejectionReason.startsWith("Requires") + || rejectionReason.startsWith("Consumes") } fun getRejectionReason(construction: CityConstructions): String { diff --git a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt index 5a81609c76..50cb86dd6b 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldMapHolder.kt @@ -1,5 +1,6 @@ package com.unciv.ui.worldscreen +import com.badlogic.gdx.Application import com.badlogic.gdx.Gdx import com.badlogic.gdx.Input import com.badlogic.gdx.graphics.Color @@ -25,6 +26,7 @@ import com.unciv.ui.tilegroups.TileSetStrings import com.unciv.ui.tilegroups.WorldTileGroup import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.unit.UnitContextMenu +import sun.awt.ExtendedKeyCodes import kotlin.concurrent.thread @@ -60,14 +62,17 @@ class WorldMapHolder(internal val worldScreen: WorldScreen, internal val tileMap layout() // Fit the scroll pane to the contents - otherwise, setScroll won't work! - addAction(Actions.forever(Actions.delay(0.05f, Actions.run { - val amountToMove = 30/scaleX - if(Gdx.input.isKeyPressed(Input.Keys.W)) scrollY -= amountToMove - if(Gdx.input.isKeyPressed(Input.Keys.S)) scrollY += amountToMove - if(Gdx.input.isKeyPressed(Input.Keys.A)) scrollX -= amountToMove - if(Gdx.input.isKeyPressed(Input.Keys.D)) scrollX += amountToMove - updateVisualScroll() - }))) + // Apparently this lakes loads of CPU so restrict it as much as possible + if(Gdx.app.type==Application.ApplicationType.Desktop) { + addAction(Actions.forever(Actions.delay(0.05f, Actions.run { + val amountToMove = 30 / scaleX + if (Gdx.input.isKeyPressed(Input.Keys.W)) scrollY -= amountToMove + if (Gdx.input.isKeyPressed(Input.Keys.S)) scrollY += amountToMove + if (Gdx.input.isKeyPressed(Input.Keys.A)) scrollX -= amountToMove + if (Gdx.input.isKeyPressed(Input.Keys.D)) scrollX += amountToMove + updateVisualScroll() + }))) + } } private fun onTileClicked(tileInfo: TileInfo) {