mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 05:46:43 -04:00
Another stab at #5729 after the toInt didn't help.
This commit is contained in:
parent
eb4a76dcd0
commit
93268f53ee
@ -52,8 +52,8 @@ 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
|
||||
// There's something here that causes a bug and I'm not sure where, so let's try taking this apart piece by piece
|
||||
// Switching sort to use fixed point math. Perhaps error is due to floating comparisons
|
||||
unitsToPayFor = unitsToPayFor.sortedByDescending { it.maintenance*100000.0.toInt() }.toList().asSequence()
|
||||
// We tried toInt()ing, didn't help. Let's try converting to a final list before sorting.
|
||||
unitsToPayFor = unitsToPayFor.toList().sortedByDescending { it.maintenance }.asSequence()
|
||||
unitsToPayFor = unitsToPayFor.drop(freeUnits)
|
||||
val numberOfUnitsToPayFor = max(0.0, unitsToPayFor.sumOf { it.maintenance.toDouble() }).toFloat()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user