commit 80d5ef46b2f849aabb5e38e1368cadf7393e77d6
parent c62db78ea01e59f897b29ec1d2817af735ad206b
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Fri, 8 Dec 2023 04:35:27 -0500
cleanup
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -710,9 +710,12 @@ func dealerThread(db *database.DkfDB, g *PokerGame, roomID string) {
for _, p := range g.Ongoing.Players {
if p != nil && !p.Folded {
p.CardsMtx.RLock()
- evt1 := PokerEvent{ID: "card" + itoa(p.Cards[0].Idx), Name: p.Cards[0].Name, Idx: p.Cards[0].Idx, Top: seats[p.SeatIdx].Top, Left: seats[p.SeatIdx].Left, Reveal: true}
- evt2 := PokerEvent{ID: "card" + itoa(p.Cards[1].Idx), Name: p.Cards[1].Name, Idx: p.Cards[1].Idx, Top: seats[p.SeatIdx].Top, Left: seats[p.SeatIdx].Left + 53, Reveal: true}
+ firstCard := p.Cards[0]
+ secondCard := p.Cards[1]
p.CardsMtx.RUnlock()
+ seatData := seats[p.SeatIdx]
+ evt1 := PokerEvent{ID: "card" + itoa(firstCard.Idx), Name: firstCard.Name, Idx: firstCard.Idx, Top: seatData.Top, Left: seatData.Left, Reveal: true}
+ evt2 := PokerEvent{ID: "card" + itoa(secondCard.Idx), Name: secondCard.Name, Idx: secondCard.Idx, Top: seatData.Top, Left: seatData.Left + 53, Reveal: true}
PokerPubSub.Pub(roomTopic, evt1)
PokerPubSub.Pub(roomTopic, evt2)
g.Ongoing.AddEvent(evt1, evt2)