aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/baccarat.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-17 22:00:33 -0400
committerhistoria <[not public]>2026-09-17 22:00:33 -0400
commit32a3c59cebf2a16277e54d715a67adfdbe00b456 (patch)
tree9bc87011513ef92f0613d9339fc55689f130915d /internal/casino/baccarat.go
parentfea2cc6839ec3ee17940a2dea69622dc6f4deabf (diff)
downloadthehouseoficarus-32a3c59cebf2a16277e54d715a67adfdbe00b456.tar.gz
fix: exact casino settlement/refund coverage, journal damage handling, craft output ordering, aggregate ingredient planning
Diffstat (limited to 'internal/casino/baccarat.go')
-rw-r--r--internal/casino/baccarat.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/casino/baccarat.go b/internal/casino/baccarat.go
index fa54ac8..f4f5fbd 100644
--- a/internal/casino/baccarat.go
+++ b/internal/casino/baccarat.go
@@ -28,6 +28,9 @@ type baccaratPlayer struct {
Participant
lastBet int
lastSpot string
+ // stakeID is the wallet handle of the wager record committed this
+ // round; the settlement returns it inside the payout.
+ stakeID string
}
func (p *baccaratPlayer) participantPtr() *Participant { return &p.Participant }
@@ -128,7 +131,7 @@ func (t *baccaratTable) bet(name, spot string, amount int, wallet Wallet) []Even
if err != nil {
return []Event{t.private(name, walletErrorMessage(err))}
}
- p.HasBet, p.Wager, p.Wallet, p.lastBet, p.lastSpot = true, wager, wallet, amount, spot
+ p.HasBet, p.Wager, p.Wallet, p.lastBet, p.lastSpot, p.stakeID = true, wager, wallet, amount, spot, wager.ID
events := []Event{t.playerAction(name,
fmt.Sprintf("%s bets %d credits on %s.", name, amount, spot),
fmt.Sprintf("You bet %d credits on %s.", amount, spot))}
@@ -193,7 +196,7 @@ func (t *baccaratTable) deal() []Event {
result, payout := settleBaccaratBet(p.lastSpot, p.Wager.Total, playerTotal, bankerTotal, t.Rules)
payoutFailed := false
if payout > 0 && p.Wallet != nil {
- if err := p.Wallet.PayCredits(payout); err != nil {
+ if err := p.Wallet.PayStakeCover(payout, []string{p.stakeID}); err != nil {
// The payout could not be made durable; recovery will
// re-apply the owed amount from the open journal record.
// Do not announce the win as paid and leave the stakes
@@ -257,6 +260,9 @@ func (t *baccaratTable) resetRound() {
t.phase = baccaratWaiting
t.window.close()
clearBets(t.players.participants())
+ for _, p := range t.players.ordered() {
+ p.stakeID = ""
+ }
}
// markDisconnected removes the player from the table, forfeiting any wager