Allow to buy buildings from the queue (#2032)

* Allow to buy buildings from the queue

* Minor refactoring
This commit is contained in:
JackRainy 2020-02-29 20:10:24 +02:00 committed by GitHub
parent f081f02006
commit 9fbd569e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -223,8 +223,10 @@ class Building : NamedStats(), IConstruction{
}
override fun shouldBeDisplayed(construction: CityConstructions): Boolean {
val rejectionReason = getRejectionReason(construction)
override fun shouldBeDisplayed(cityConstructions: CityConstructions): Boolean {
if (cityConstructions.isBeingConstructedOrEnqueued(name))
return false
val rejectionReason = getRejectionReason(cityConstructions)
return rejectionReason==""
|| rejectionReason.startsWith("Requires")
|| rejectionReason == "Wonder is being built elsewhere"
@ -232,8 +234,6 @@ class Building : NamedStats(), IConstruction{
fun getRejectionReason(construction: CityConstructions):String{
if (construction.isBuilt(name)) return "Already built"
if (construction.isBeingConstructed(name)) return "Is being built"
if (construction.isEnqueued(name)) return "Already enqueued"
val cityCenter = construction.cityInfo.getCenterTile()
if ("Must be next to desert" in uniques