commit 538fc86cc8940c2314fcb01e56b74778bd7e5a07
parent 7f9b41bf47346eff38421ce1afe80efdcd1767e5
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Mon, 25 Dec 2023 11:26:18 -0500
cleanup
Diffstat:
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -1530,19 +1530,17 @@ func processPot(winners []gameResult, mainPot, pokerTableMinBet database.PokerCh
groupPlayers := group.players
groupPlayersLen := len(groupPlayers)
handStr := poker.RankString(group.handScore)
- if groupPlayersLen == 1 && groupPlayers[0].getCash() > 0 {
- // Only 1 player win and is not all-in
+ if groupPlayersLen == 1 {
player := groupPlayers[0]
piece := mainPot
+ if player.isAllIn() {
+ piece = utils.MinInt(player.allInMaxGain, piece)
+ }
res = append(res, newPlayerGain(player, piece, groupIdx, handStr))
mainPot -= piece
- } else if groupPlayersLen == 1 && groupPlayers[0].isAllIn() {
- // Only 1 player win but is all-in
- player := groupPlayers[0]
- piece := utils.MinInt(player.allInMaxGain, mainPot)
- res = append(res, newPlayerGain(player, piece, groupIdx, handStr))
- mainPot -= piece
- continue
+ if player.isAllIn() { // Only 1 player win but is all-in
+ continue
+ }
} else if groupPlayersLen > 1 {
// Multiple winners, split pot
expectedSplit := mainPot / database.PokerChip(groupPlayersLen)
@@ -1550,8 +1548,7 @@ func processPot(winners []gameResult, mainPot, pokerTableMinBet database.PokerCh
for _, p := range groupPlayers {
if p.isAllIn() {
allInCount++
- maxGain := p.allInMaxGain
- piece := utils.MinInt(maxGain, expectedSplit, mainPot)
+ piece := utils.MinInt(p.allInMaxGain, expectedSplit, mainPot)
res = append(res, newPlayerGain(p, piece, groupIdx, handStr))
mainPot -= piece
if groupPlayersLen-allInCount > 0 {