mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-25 12:54:06 -04:00
Fix buy current construction (#1794)
This commit is contained in:
parent
d22b3acbb3
commit
ea29f91519
@ -99,9 +99,9 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
constructionsQueueTable.addSeparator()
|
constructionsQueueTable.addSeparator()
|
||||||
|
|
||||||
if (currentConstruction != "")
|
if (currentConstruction != "")
|
||||||
constructionsQueueTable.add(getQueueEntry(-1, currentConstruction, queue.isEmpty(), selectedQueueEntry == -1))
|
constructionsQueueTable.add(getQueueEntry(-1, currentConstruction, queue.isEmpty(), isSelectedCurrentConstruction()))
|
||||||
.expandX().fillX().row()
|
.expandX().fillX().row()
|
||||||
else
|
else
|
||||||
constructionsQueueTable.add("Pick a construction".toLabel()).pad(2f).row()
|
constructionsQueueTable.add("Pick a construction".toLabel()).pad(2f).row()
|
||||||
|
|
||||||
constructionsQueueTable.addSeparator()
|
constructionsQueueTable.addSeparator()
|
||||||
@ -227,6 +227,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
return pickProductionButton
|
return pickProductionButton
|
||||||
}
|
}
|
||||||
private fun isSelectedQueueEntry(): Boolean = selectedQueueEntry > -2
|
private fun isSelectedQueueEntry(): Boolean = selectedQueueEntry > -2
|
||||||
|
private fun isSelectedCurrentConstruction(): Boolean = selectedQueueEntry == -1
|
||||||
|
|
||||||
private fun getQueueButton(construction: IConstruction?): TextButton {
|
private fun getQueueButton(construction: IConstruction?): TextButton {
|
||||||
val city = cityScreen.city
|
val city = cityScreen.city
|
||||||
@ -287,7 +288,10 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
|
|||||||
YesNoPopup("Would you like to purchase [${construction.name}] for [$constructionGoldCost] gold?".tr(), {
|
YesNoPopup("Would you like to purchase [${construction.name}] for [$constructionGoldCost] gold?".tr(), {
|
||||||
cityConstructions.purchaseConstruction(construction.name)
|
cityConstructions.purchaseConstruction(construction.name)
|
||||||
if (isSelectedQueueEntry()) {
|
if (isSelectedQueueEntry()) {
|
||||||
cityConstructions.removeFromQueue(selectedQueueEntry)
|
// currentConstruction is removed from the queue by purchaseConstruction
|
||||||
|
// to avoid conflicts with NextTurnAutomation
|
||||||
|
if (!isSelectedCurrentConstruction())
|
||||||
|
cityConstructions.removeFromQueue(selectedQueueEntry)
|
||||||
selectedQueueEntry = -2
|
selectedQueueEntry = -2
|
||||||
cityScreen.selectedConstruction = null
|
cityScreen.selectedConstruction = null
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user