diff options
Diffstat (limited to 'internal/casino/baccarat.go')
| -rw-r--r-- | internal/casino/baccarat.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/internal/casino/baccarat.go b/internal/casino/baccarat.go index 62a83a5..53ed0a9 100644 --- a/internal/casino/baccarat.go +++ b/internal/casino/baccarat.go @@ -241,7 +241,15 @@ func (t *baccaratTable) markDisconnected(name string) []Event { return nil } if p := t.players.get(name); p != nil && p.HasBet && p.Wallet != nil { - p.Wallet.RefundOutstanding() + if _, _, err := p.Wallet.RefundOutstanding(); err != nil { + // The stake stays pending on disk and startup recovery will return + // it, but tell the departing player instead of silently swallowing + // the failure. + t.removeSeatLocked(name) + events := []Event{t.event(fmt.Sprintf("%s stands up.", name), true)} + events = append(events, t.private(name, "Your stake could not be returned just now; it stays pending and will be refunded after the next server restart.")) + return t.closeIfEmptyLocked(events) + } } t.removeSeatLocked(name) events := []Event{t.event(fmt.Sprintf("%s stands up.", name), true)} |
