Fixed #438 - changing production before answering the "do you want to purchase construction" popup lead to buying the newly chosen production

This commit is contained in:
Yair Morgenstern 2019-01-26 22:00:48 +02:00
parent 478a9e6996
commit 665af17ae5
2 changed files with 3 additions and 3 deletions

View File

@ -128,7 +128,7 @@ class ConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBaseScre
purchaseConstructionButton = TextButton("Buy for [$buildingGoldCost] gold".tr(), CameraStageBaseScreen.skin)
purchaseConstructionButton.onClick("coin") {
YesNoPopupTable("Would you like to purchase [${construction.name}] for [$buildingGoldCost] gold?".tr(), {
city.cityConstructions.purchaseBuilding(city.cityConstructions.currentConstruction)
city.cityConstructions.purchaseBuilding(construction.name)
update()
}, cityScreen)
}

View File

@ -50,7 +50,6 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
techMatrix[technology.column!!.columnNumber][technology.row - 1] = technology
}
val alreadyDisplayedEras = HashSet<String>()
val eras = ArrayList<Label>()
for(i in techMatrix.indices) eras.add(Label("",CameraStageBaseScreen.skin).apply { setFontColor(Color.WHITE) })
eras.forEach { topTable.add(it) }
@ -77,13 +76,14 @@ class TechPickerScreen(internal val civInfo: CivilizationInfo) : PickerScreen()
}
// Set era names (column by column)
val alreadyDisplayedEras = HashSet<String>()
for(j in techMatrix.indices)
for(i in 0..9)
{
val tech = techMatrix[j][i]
if(tech==null) continue
val eraName = tech.era().name
if(!alreadyDisplayedEras.contains(eraName)) { // name of era was not yet set
if(!alreadyDisplayedEras.contains(eraName)) { // name of era was not yet displayed
eras[j].setText("$eraName era".tr())
alreadyDisplayedEras.add(eraName)
}