dkforest

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

commit e9167b2dcf7d8e6e37c38e8c7640d63fd98cbba9
parent df6fbe4f81bc39f8aaa477b13964da5564fd1bac
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 18 Dec 2023 04:37:00 -0500

cleanup

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -94,11 +94,11 @@ type Ongoing struct { Players []*PokerPlayer Events utils.RWMtx[[]PokerEvent] LogEvents utils.RWMtx[[]LogEvent] - CommunityCards []string WaitTurnEvent utils.RWMtx[PokerWaitTurnEvent] AutoActionEvent utils.RWMtx[AutoActionEvent] CreatedAt time.Time mainPot atomic.Uint64 + communityCards []string } type SeatedPlayer struct { @@ -239,16 +239,16 @@ func (g *Ongoing) computeWinners() (winner []GameResult) { playerCard2 = (*pCards)[1].Name }) - if len(g.CommunityCards) != 5 { + communityCards := g.communityCards + if len(communityCards) != 5 { return []GameResult{} } - hand := []poker.Card{ - poker.NewCard(cardToPokerCard(g.CommunityCards[0])), - poker.NewCard(cardToPokerCard(g.CommunityCards[1])), - poker.NewCard(cardToPokerCard(g.CommunityCards[2])), - poker.NewCard(cardToPokerCard(g.CommunityCards[3])), - poker.NewCard(cardToPokerCard(g.CommunityCards[4])), + poker.NewCard(cardToPokerCard(communityCards[0])), + poker.NewCard(cardToPokerCard(communityCards[1])), + poker.NewCard(cardToPokerCard(communityCards[2])), + poker.NewCard(cardToPokerCard(communityCards[3])), + poker.NewCard(cardToPokerCard(communityCards[4])), poker.NewCard(cardToPokerCard(playerCard1)), poker.NewCard(cardToPokerCard(playerCard2)), } @@ -999,7 +999,7 @@ func dealerThread(g *PokerGame) { } PokerPubSub.Pub(roomTopic, evt) ongoing.AddEvent(evt) - ongoing.CommunityCards = append(ongoing.CommunityCards, card) + ongoing.communityCards = append(ongoing.communityCards, card) } sbIdx, bbIdx := g.incrDealerIdx()