dkforest

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

commit abc6f36b415b41b5a4f94931835c957bb2f3f6c6
parent 03b76979ba9792566d8bae95a8661e73f47406bd
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  7 Dec 2023 04:00:48 -0500

cleanup

Diffstat:
Mpkg/actions/actions.go | 2+-
Mpkg/web/handlers/poker/poker.go | 17+++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pkg/actions/actions.go b/pkg/actions/actions.go @@ -130,7 +130,7 @@ func runMigrations(db *database.DkfDB) { logrus.Infof("applied %d migrations", n) } -// Ensure the project folder is created properly +// Ensure the project folder is created properly func ensureProjectHome() { config.Global.SetProjectPath(utils.MustGetDefaultProjectPath()) projectPath := config.Global.ProjectPath() diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -394,19 +394,20 @@ OUTER: newLogEvent(g, roomLogsTopic, fmt.Sprintf("%s call", p.Username)) } else if evt.Bet > 0 { - if (p.Bet + evt.Bet) < minBet { - msg := fmt.Sprintf("Bet (%d) is too low. Must bet at least %d", evt.Bet, minBet-p.Bet) + bet := evt.Bet + if (p.Bet + bet) < minBet { + msg := fmt.Sprintf("Bet (%d) is too low. Must bet at least %d", bet, minBet-p.Bet) PokerPubSub.Pub(roomUserTopic, ErrorMsgEvent{Message: msg}) continue } - if (p.Bet + evt.Bet) > minBet { + if (p.Bet + bet) > minBet { lastRisePlayerIdx = p.SeatIdx } - minBet = p.Bet + evt.Bet - p.Bet += evt.Bet - p.Cash -= evt.Bet - PokerPubSub.Pub(roomTopic, PlayerBetEvent{PlayerIdx: p.SeatIdx, Player: p.Username, Bet: evt.Bet, TotalBet: p.Bet, Cash: p.Cash}) - newLogEvent(g, roomLogsTopic, fmt.Sprintf("%s bet %d", p.Username, evt.Bet)) + minBet = p.Bet + bet + p.Bet += bet + p.Cash -= bet + PokerPubSub.Pub(roomTopic, PlayerBetEvent{PlayerIdx: p.SeatIdx, Player: p.Username, Bet: bet, TotalBet: p.Bet, Cash: p.Cash}) + newLogEvent(g, roomLogsTopic, fmt.Sprintf("%s bet %d", p.Username, bet)) } else { continue