diff options
| author | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-06 12:57:23 -0400 |
| commit | 9666676766bf21364f4fc4d0d1d336e72f2a91b4 (patch) | |
| tree | 0cade34091d7602790dc38cd44053f0b74bbadf2 /internal/casino/pai_gow.go | |
| parent | 4bc1daaf259e0c19c5fe4a12ec8bc7f6e5a735c1 (diff) | |
| download | thehouseoficarus-9666676766bf21364f4fc4d0d1d336e72f2a91b4.tar.gz | |
refactor: split casino.go, dedup helpers, remove audit docs
Diffstat (limited to 'internal/casino/pai_gow.go')
| -rw-r--r-- | internal/casino/pai_gow.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/internal/casino/pai_gow.go b/internal/casino/pai_gow.go index 55dc601..8a7ddf3 100644 --- a/internal/casino/pai_gow.go +++ b/internal/casino/pai_gow.go @@ -88,6 +88,7 @@ type paiGowTable struct { dealer []card dealerSplit pgSplit tie [2]card + settleTried bool // guards against re-saving/re-messaging every tick while settling } func newPaiGowTable(room int, c TableConfig, rng *rand.Rand) tableGame { @@ -601,6 +602,7 @@ func (t *paiGowTable) action(name, action string) []Event { } func (t *paiGowTable) prepareSettlementLocked() []Event { t.phase = phaseSettling + t.settleTried = false for _, p := range t.players { if p.main.Total == 0 { continue @@ -742,6 +744,13 @@ func (t *paiGowTable) tick() []Event { defer t.mu.Unlock() switch t.phase { case phaseSettling: + // Try to settle once automatically. If storage is persistently failing, + // do not re-attempt the full save (and failure message) every tick; the + // explicit `settle` command retries instead. + if t.settleTried { + return nil + } + t.settleTried = true return t.payLocked() case phaseBetting: if t.allBetLocked() { @@ -868,7 +877,7 @@ func (t *paiGowTable) refundSideBetsLocked(p *pgPlayer) []Event { } e := t.private(p.name, fmt.Sprintf("Your %d in side bets is returned; no main wager was placed.", total)) if p.wallet != nil { - if err := p.wallet.PayCredits(total, ids...); err != nil { + if err := p.wallet.RefundStakes(ids...); err != nil { e.Message = payoutFailedMessage() } } @@ -938,7 +947,7 @@ func (t *paiGowTable) unbetLocked(p *pgPlayer) []Event { return []Event{t.private(p.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(p.name, payoutFailedMessage())} } } |
