dkforest

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

commit 4e48b22fc3e0db5f3c0f50b3a8e91784ea557c4c
parent 064f652dd9d8486a435b5e1f1a8dc927c66daa8d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 15 Dec 2023 04:27:02 -0500

cleanup

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -525,8 +525,7 @@ OUTER: if lastRaisePlayerIdx == -1 { lastRaisePlayerIdx = playerToPlayIdx } - player := g.Ongoing.GetPlayer(p.Username) - if player.Folded.Load() || player.isAllIn() { + if p.Folded.Load() || p.isAllIn() { continue } @@ -548,12 +547,12 @@ OUTER: break LOOP } if p.Bet < minBet { - player.Folded.Store(true) + p.Folded.Store(true) - player.CardsMtx.RLock() - evt1 := PokerEvent{ID: "card" + itoa(player.Cards[0].Idx), Name: "", Idx: player.Cards[0].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} - evt2 := PokerEvent{ID: "card" + itoa(player.Cards[1].Idx), Name: "", Idx: player.Cards[1].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} - player.CardsMtx.RUnlock() + p.CardsMtx.RLock() + evt1 := PokerEvent{ID: "card" + itoa(p.Cards[0].Idx), Name: "", Idx: p.Cards[0].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} + evt2 := PokerEvent{ID: "card" + itoa(p.Cards[1].Idx), Name: "", Idx: p.Cards[1].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} + p.CardsMtx.RUnlock() PokerPubSub.Pub(roomTopic, evt1) PokerPubSub.Pub(roomTopic, evt2) g.Ongoing.AddEvent(evt1, evt2) @@ -583,13 +582,13 @@ OUTER: continue } - player.LastActionTS = time.Now() + p.LastActionTS = time.Now() if evt.Fold { - player.Folded.Store(true) + p.Folded.Store(true) - evt1 := PokerEvent{ID: "card" + itoa(player.Cards[0].Idx), Name: "", Idx: player.Cards[0].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} - evt2 := PokerEvent{ID: "card" + itoa(player.Cards[1].Idx), Name: "", Idx: player.Cards[1].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} + evt1 := PokerEvent{ID: "card" + itoa(p.Cards[0].Idx), Name: "", Idx: p.Cards[0].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} + evt2 := PokerEvent{ID: "card" + itoa(p.Cards[1].Idx), Name: "", Idx: p.Cards[1].Idx, Top: BurnStackY, Left: BurnStackX, Angle: "0deg", Reveal: false} PokerPubSub.Pub(roomTopic, evt1) PokerPubSub.Pub(roomTopic, evt2) g.Ongoing.AddEvent(evt1, evt2)