Skip to content

Commit

Permalink
Okay that was dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Jul 19, 2024
1 parent fbcf221 commit 37b4bcb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/com/unciv/logic/city/CityConstructions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,15 @@ class CityConstructions : IsPartOfGameInfoSerialization {
}


/** This tests whether the buy button should be _enabled_ */
/** This is the *one true test* of "can we buty this construction"
* This tests whether the buy button should be _enabled_ */
fun isConstructionPurchaseAllowed(construction: INonPerpetualConstruction, stat: Stat, constructionBuyCost: Int): Boolean {
return when {
city.isPuppet && !city.getMatchingUniques(UniqueType.MayBuyConstructionsInPuppets).any() -> false
city.isInResistance() -> false
!construction.isPurchasable(city.cityConstructions) -> false // checks via 'rejection reason'
construction is BaseUnit && !city.canPlaceNewUnit(construction) -> false
!construction.canBePurchasedWithStat(city, stat) -> false
city.civ.gameInfo.gameParameters.godMode -> true
constructionBuyCost == 0 -> true
else -> city.getStatReserve(stat) >= constructionBuyCost
Expand Down

0 comments on commit 37b4bcb

Please sign in to comment.