dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit fd9843bb1728f45830ab403773bc886e808f33f6
parent 9dcce8a6f64be76b8d1654f40dfc1e14827c062d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 25 Dec 2023 14:47:52 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 19++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -524,22 +524,15 @@ func isSeated(players seatedPlayers, userID database.UserID) bool { } func isRoundSettled(players []*PokerPlayer) bool { - type Tmp struct { - Bet database.PokerChip - AllIn bool - Folded bool - } - arr := make([]Tmp, 0) - for _, p := range players { - arr = append(arr, Tmp{Bet: p.GetBet(), AllIn: p.isAllIn(), Folded: p.folded.Load()}) - } - sort.Slice(arr, func(i, j int) bool { return arr[i].Bet > arr[j].Bet }) - b := arr[0].Bet + arr := make([]*PokerPlayer, len(players)) + copy(arr, players) + sort.Slice(arr, func(i, j int) bool { return arr[i].GetBet() > arr[j].GetBet() }) + b := arr[0].GetBet() for _, el := range arr { - if el.Folded || el.AllIn { + if !el.canBet() { continue } - if el.Bet != b { + if el.GetBet() != b { return false } }