aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/baccarat.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/baccarat.go')
-rw-r--r--internal/casino/baccarat.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/internal/casino/baccarat.go b/internal/casino/baccarat.go
index d385834..94d960a 100644
--- a/internal/casino/baccarat.go
+++ b/internal/casino/baccarat.go
@@ -264,6 +264,11 @@ func (t *baccaratTable) rebetAll(name string, wallet Wallet) []Event {
if !p.hasLastBet() {
return []Event{t.private(name, "Bet on what? Try bet N on "+t.Rules.betChoices()+".")}
}
+ // Require the main wager before committing remembered side bets: a
+ // side-only memory would otherwise charge the sides and never deal.
+ if p.mainSpot == "" || p.lastBets[p.mainSpot] <= 0 {
+ return []Event{t.private(name, "Your last bet had no main wager. Use bet N on " + t.Rules.betChoices() + ".")}
+ }
var events []Event
for _, spot := range t.Rules.spots() {
if baccaratIsMainSpot(spot) {
@@ -374,7 +379,7 @@ func (t *baccaratTable) unbetAllLocked(name string) []Event {
return []Event{t.private(name, "Nothing to take back.")}
}
if p.Wallet != nil {
- if err := p.Wallet.PayCredits(total, ids...); err != nil {
+ if err := p.Wallet.RefundStakes(ids...); err != nil {
return []Event{t.private(name, payoutFailedMessage())}
}
}
@@ -399,7 +404,7 @@ func (t *baccaratTable) refundSidesLocked(p *baccaratPlayer) []Event {
return nil
}
if p.Wallet != nil {
- if err := p.Wallet.PayCredits(total, ids...); err != nil {
+ if err := p.Wallet.RefundStakes(ids...); err != nil {
return []Event{t.private(p.Name, "Your side bets could not be returned just now; the stake stays pending and will be refunded after the next server restart.")}
}
}
@@ -476,7 +481,7 @@ func (t *baccaratTable) deal() []Event {
settlement := t.playerAction(p.Name, publicResult, privateResult)
// Returning players get their balance in the next bet menu; only
// departures/sit-outs need it attached to the settlement.
- settlement.ShowBalance = !payoutFailed && (p.LeaveAfter || p.SitOutAfter || !p.Connected)
+ settlement.ShowBalance = p.SettlementBalanceNeeded(payoutFailed)
if !payoutFailed {
settlement.Settlement = lines
switch {