|
|
|
|
@ -642,19 +642,22 @@ open class HandHistory : RealmObject(), Deletable, RowRepresentable, Filterable, |
|
|
|
|
|
|
|
|
|
pots.forEach { pot -> |
|
|
|
|
|
|
|
|
|
val winningPositions = compareHands(pot.positions.toList()) |
|
|
|
|
|
|
|
|
|
// Distributes the pot for each winners |
|
|
|
|
val share = pot.amount / winningPositions.size |
|
|
|
|
winningPositions.forEach { p -> |
|
|
|
|
val wp = wonPots[p] |
|
|
|
|
if (wp == null) { |
|
|
|
|
val wonPot = WonPot() |
|
|
|
|
wonPot.position = p |
|
|
|
|
wonPot.amount = share |
|
|
|
|
wonPots[p] = wonPot |
|
|
|
|
} else { |
|
|
|
|
wp.amount += share |
|
|
|
|
if (pot.positions.size > 1) { // we only consider contested pots |
|
|
|
|
|
|
|
|
|
val winningPositions = compareHands(pot.positions.toList()) |
|
|
|
|
|
|
|
|
|
// Distributes the pot for each winners |
|
|
|
|
val share = pot.amount / winningPositions.size |
|
|
|
|
winningPositions.forEach { p -> |
|
|
|
|
val wp = wonPots[p] |
|
|
|
|
if (wp == null) { |
|
|
|
|
val wonPot = WonPot() |
|
|
|
|
wonPot.position = p |
|
|
|
|
wonPot.amount = share |
|
|
|
|
wonPots[p] = wonPot |
|
|
|
|
} else { |
|
|
|
|
wp.amount += share |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|