mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Keep the perpetual construciton going, if the user set it manually.
This commit is contained in:
parent
1f3b77d038
commit
6c3faec6ac
@ -11,6 +11,7 @@ import com.unciv.models.ruleset.unit.BaseUnit
|
|||||||
import com.unciv.models.stats.Stats
|
import com.unciv.models.stats.Stats
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.cityscreen.ConstructionInfoTable
|
import com.unciv.ui.cityscreen.ConstructionInfoTable
|
||||||
|
import com.unciv.ui.utils.Fonts
|
||||||
import com.unciv.ui.utils.withItem
|
import com.unciv.ui.utils.withItem
|
||||||
import com.unciv.ui.utils.withoutItem
|
import com.unciv.ui.utils.withoutItem
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -116,13 +117,13 @@ class CityConstructions {
|
|||||||
|
|
||||||
fun getProductionForTileInfo(): String {
|
fun getProductionForTileInfo(): String {
|
||||||
/* this is because there were rare errors tht I assume were caused because
|
/* 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
|
val currentConstructionSnapshot = currentConstructionFromQueue
|
||||||
var result = currentConstructionSnapshot.tr()
|
var result = currentConstructionSnapshot.tr()
|
||||||
if (currentConstructionSnapshot!=""
|
if (currentConstructionSnapshot!=""
|
||||||
&& !PerpetualConstruction.perpetualConstructionsMap.containsKey(currentConstructionSnapshot)) {
|
&& !PerpetualConstruction.perpetualConstructionsMap.containsKey(currentConstructionSnapshot)) {
|
||||||
val turnsLeft = turnsToConstruction(currentConstructionSnapshot)
|
val turnsLeft = turnsToConstruction(currentConstructionSnapshot)
|
||||||
result += ConstructionInfoTable.turnOrTurns(turnsLeft)
|
result += " - $turnsLeft ${Fonts.turn}"
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@ -376,8 +377,9 @@ class CityConstructions {
|
|||||||
fun chooseNextConstruction() {
|
fun chooseNextConstruction() {
|
||||||
validateConstructionQueue()
|
validateConstructionQueue()
|
||||||
if (constructionQueue.isNotEmpty()) {
|
if (constructionQueue.isNotEmpty()) {
|
||||||
currentConstructionIsUserSet = true
|
if (currentConstructionFromQueue != ""
|
||||||
if (currentConstructionFromQueue != "" && getConstruction(currentConstructionFromQueue) !is PerpetualConstruction) return
|
// If the USER set a perpetual construction, then keep it!
|
||||||
|
&& (getConstruction(currentConstructionFromQueue) !is PerpetualConstruction || currentConstructionIsUserSet)) return
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstructionAutomation(this).chooseNextConstruction()
|
ConstructionAutomation(this).chooseNextConstruction()
|
||||||
|
@ -373,7 +373,7 @@ open class TileInfo {
|
|||||||
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.toString().tr()
|
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.toString().tr()
|
||||||
if (improvement != null) lineList += improvement!!.tr()
|
if (improvement != null) lineList += improvement!!.tr()
|
||||||
if (improvementInProgress != null && isViewableToPlayer)
|
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)
|
if (civilianUnit != null && isViewableToPlayer)
|
||||||
lineList += civilianUnit!!.name.tr() + " - " + civilianUnit!!.civInfo.civName.tr()
|
lineList += civilianUnit!!.name.tr() + " - " + civilianUnit!!.civInfo.civName.tr()
|
||||||
if (militaryUnit != null && isViewableToPlayer) {
|
if (militaryUnit != null && isViewableToPlayer) {
|
||||||
|
@ -55,7 +55,7 @@ class ImprovementPickerScreen(val tileInfo: TileInfo, val onAccept: ()->Unit) :
|
|||||||
|
|
||||||
var labelText = improvement.name.tr()
|
var labelText = improvement.name.tr()
|
||||||
val turnsToBuild = improvement.getTurnsToBuild(currentPlayerCiv)
|
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
|
val provideResource = tileInfo.hasViewableResource(currentPlayerCiv) && tileInfo.getTileResource().improvement == improvement.name
|
||||||
if (provideResource) labelText += "\n" + "Provides [${tileInfo.resource}]".tr()
|
if (provideResource) labelText += "\n" + "Provides [${tileInfo.resource}]".tr()
|
||||||
val removeImprovement = (improvement.name != RoadStatus.Road.name
|
val removeImprovement = (improvement.name != RoadStatus.Road.name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user