dkforest

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

commit 8d27cd448ed19814ca081b20baeecd34565e042f
parent ff47988430c8d197537083e2aaefea8d80703b17
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu, 21 Dec 2023 22:29:50 -0500

cleanup

Diffstat:
Mpkg/web/handlers/poker/poker.go | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -784,14 +784,15 @@ func doBet(g *PokerGame, p *pokerPlayer, minBet *database.PokerChip, roomUserTopic := g.roomID.UserTopic(p.userID) pokerTableMinBet := g.PokerTableMinBet bet := evt.Bet + playerBet := p.getBet() // Ensure the player cannot bet below the table minimum bet (amount of the big blind) - if p.getBet()+bet != *minBet && bet < pokerTableMinBet { + if playerBet+bet != *minBet && bet < pokerTableMinBet { msg := fmt.Sprintf("Bet (%d) is too low. Must bet at least %d", bet, pokerTableMinBet) PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) return continueGetPlayerEventLoop } - if (p.getBet() + bet) < *minBet { - msg := fmt.Sprintf("Bet (%d) is too low. Must bet at least %d", bet, *minBet-p.getBet()) + if (playerBet + bet) < *minBet { + msg := fmt.Sprintf("Bet (%d) is too low. Must bet at least %d", bet, *minBet-playerBet) PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) return continueGetPlayerEventLoop } @@ -800,10 +801,10 @@ func doBet(g *PokerGame, p *pokerPlayer, minBet *database.PokerChip, PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) return continueGetPlayerEventLoop } - if (p.getBet() + bet) > *minBet { + if (playerBet + bet) > *minBet { *lastRaisePlayerIdx = playerToPlayIdx } - *minBet = utils.MaxInt(p.getBet()+bet, *minBet) + *minBet = utils.MaxInt(playerBet+bet, *minBet) p.doBetAndNotif(g.db, g.pokerTableID, bet, roomTopic) logMsg := fmt.Sprintf("%s bet %d", p.username, bet) if p.isAllIn() { @@ -944,9 +945,9 @@ RoundIsSettledLoop: var evt playerEvent actionResult := doNothing // Check for pre-selected action - if autoAction, ok := autoCache[pUserID]; ok { + if autoActionVal, ok := autoCache[pUserID]; ok { actionResult = applyAutoAction(g, p, &minBet, &newlyAllInPlayers, - &lastRaisePlayerIdx, &playerAlive, playerToPlayIdx, autoAction, autoCache) + &lastRaisePlayerIdx, &playerAlive, playerToPlayIdx, autoActionVal, autoCache) goto checkActionResult } select {