mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-31 18:04:55 +07:00
Legalism grants enqueued buildings (#1906)
This commit is contained in:
parent
942092e33e
commit
b9e3ca5fd4
@ -301,14 +301,14 @@ class CityConstructions {
|
||||
fun hasBuildableCultureBuilding(): Boolean {
|
||||
return getBasicCultureBuildings()
|
||||
.map { cityInfo.civInfo.getEquivalentBuilding(it.name) }
|
||||
.filter { it.isBuildable(this) || it.name == currentConstruction}
|
||||
.filter { it.isBuildable(this) || isBeingConstructedOrEnqueued(it.name) }
|
||||
.any()
|
||||
}
|
||||
|
||||
fun addCultureBuilding(): String? {
|
||||
val buildableCultureBuildings = getBasicCultureBuildings()
|
||||
.map { cityInfo.civInfo.getEquivalentBuilding(it.name) }
|
||||
.filter { it.isBuildable(this) || it.name == currentConstruction }
|
||||
.filter { it.isBuildable(this) || isBeingConstructedOrEnqueued(it.name) }
|
||||
|
||||
if (!buildableCultureBuildings.any())
|
||||
return null
|
||||
@ -316,8 +316,10 @@ class CityConstructions {
|
||||
val cultureBuildingToBuild = buildableCultureBuildings.minBy { it.cost }!!.name
|
||||
constructionComplete(getConstruction(cultureBuildingToBuild))
|
||||
|
||||
if (currentConstruction == cultureBuildingToBuild)
|
||||
if (isBeingConstructed(cultureBuildingToBuild))
|
||||
cancelCurrentConstruction()
|
||||
else if (isEnqueued(cultureBuildingToBuild))
|
||||
removeFromQueue(cultureBuildingToBuild)
|
||||
|
||||
return cultureBuildingToBuild
|
||||
}
|
||||
@ -353,6 +355,11 @@ class CityConstructions {
|
||||
}
|
||||
}
|
||||
|
||||
fun removeFromQueue(constructionName: String) {
|
||||
if (constructionName in constructionQueue)
|
||||
constructionQueue.remove(constructionName)
|
||||
}
|
||||
|
||||
fun removeFromQueue(constructionQueueIndex: Int) {
|
||||
// constructionQueueIndex -1 is the current construction
|
||||
if (constructionQueueIndex < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user