Trying to find the cause of #5729

This commit is contained in:
yairm210 2021-12-05 21:33:04 +02:00
parent 0d4da03b7c
commit 144d2738a4
3 changed files with 7 additions and 2 deletions

View File

@ -51,7 +51,9 @@ class CivInfoStats(val civInfo: CivilizationInfo) {
}
// Sort by descending maintenance, then drop most expensive X units to make them free
// If more free than units left, returns empty sequence
unitsToPayFor = unitsToPayFor.sortedByDescending { it.maintenance }.drop(freeUnits)
// There's something here that causes a bug and I'm not sure where, so let's try taking this apart piece by piece
unitsToPayFor = unitsToPayFor.sortedByDescending { it.maintenance }.toList().asSequence()
unitsToPayFor = unitsToPayFor.drop(freeUnits)
val numberOfUnitsToPayFor = max(0.0, unitsToPayFor.sumOf { it.maintenance.toDouble() }).toFloat()
val turnLimit =

View File

@ -790,7 +790,7 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
return ruleset.tileImprovements[improvementUnique.params[0]]
}
fun isSellable() = !isAnyWonder() && !uniques.contains("Unsellable")
fun isSellable() = !isAnyWonder() && !hasUnique(UniqueType.Unsellable)
override fun getResourceRequirements(): HashMap<String, Int> {
val resourceRequirements = HashMap<String, Int>()

View File

@ -209,6 +209,9 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
MustBeNextTo("Must be next to [terrainFilter]", UniqueTarget.Building),
MustNotBeNextTo("Must not be next to [terrainFilter]", UniqueTarget.Building),
Unsellable("Unsellable", UniqueTarget.Building),
//endregion