Keep the perpetual construciton going, if the user set it manually.

This commit is contained in:
Yair Morgenstern 2020-08-24 20:39:46 +03:00
parent 1f3b77d038
commit 6c3faec6ac
3 changed files with 8 additions and 6 deletions

View file

@ -11,6 +11,7 @@ import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.models.stats.Stats
import com.unciv.models.translations.tr
import com.unciv.ui.cityscreen.ConstructionInfoTable
import com.unciv.ui.utils.Fonts
import com.unciv.ui.utils.withItem
import com.unciv.ui.utils.withoutItem
import java.util.*
@ -116,13 +117,13 @@ class CityConstructions {
fun getProductionForTileInfo(): String {
/* this is because there were rare errors tht I assume were caused because
currentContruction changed on another thread */
currentConstruction changed on another thread */
val currentConstructionSnapshot = currentConstructionFromQueue
var result = currentConstructionSnapshot.tr()
if (currentConstructionSnapshot!=""
&& !PerpetualConstruction.perpetualConstructionsMap.containsKey(currentConstructionSnapshot)) {
val turnsLeft = turnsToConstruction(currentConstructionSnapshot)
result += ConstructionInfoTable.turnOrTurns(turnsLeft)
result += " - $turnsLeft ${Fonts.turn}"
}
return result
}
@ -376,8 +377,9 @@ class CityConstructions {
fun chooseNextConstruction() {
validateConstructionQueue()
if (constructionQueue.isNotEmpty()) {
currentConstructionIsUserSet = true
if (currentConstructionFromQueue != "" && getConstruction(currentConstructionFromQueue) !is PerpetualConstruction) return
if (currentConstructionFromQueue != ""
// If the USER set a perpetual construction, then keep it!
&& (getConstruction(currentConstructionFromQueue) !is PerpetualConstruction || currentConstructionIsUserSet)) return
}
ConstructionAutomation(this).chooseNextConstruction()

View file

@ -373,7 +373,7 @@ open class TileInfo {
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.toString().tr()
if (improvement != null) lineList += improvement!!.tr()
if (improvementInProgress != null && isViewableToPlayer)
lineList += "{$improvementInProgress}\r\n $turnsToImprovement ${Fonts.turn}".tr() // todo change to [] translation notation
lineList += "{$improvementInProgress} $turnsToImprovement ${Fonts.turn}".tr()
if (civilianUnit != null && isViewableToPlayer)
lineList += civilianUnit!!.name.tr() + " - " + civilianUnit!!.civInfo.civName.tr()
if (militaryUnit != null && isViewableToPlayer) {

View file

@ -55,7 +55,7 @@ class ImprovementPickerScreen(val tileInfo: TileInfo, val onAccept: ()->Unit) :
var labelText = improvement.name.tr()
val turnsToBuild = improvement.getTurnsToBuild(currentPlayerCiv)
if (turnsToBuild > 0) labelText += " - $turnsToBuild {turns}"
if (turnsToBuild > 0) labelText += " - $turnsToBuild ${Fonts.turn}"
val provideResource = tileInfo.hasViewableResource(currentPlayerCiv) && tileInfo.getTileResource().improvement == improvement.name
if (provideResource) labelText += "\n" + "Provides [${tileInfo.resource}]".tr()
val removeImprovement = (improvement.name != RoadStatus.Road.name