diff options
| author | historia <[not public]> | 2026-09-16 14:41:15 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-16 14:41:15 -0400 |
| commit | 9192d94dea6be5498ab080f3e2df5667af871d7a (patch) | |
| tree | e7aef3089d5d1e8da686c6b6ca9d4faeacb8b20b /internal/game/casino.go | |
| parent | 2f34e75f27e5f99cfc1c5f8eaf6ab4ff2fddb1d9 (diff) | |
| download | thehouseoficarus-9192d94dea6be5498ab080f3e2df5667af871d7a.tar.gz | |
fix: casino room eviction, session close race fix, open-payout recovery evidence
Diffstat (limited to 'internal/game/casino.go')
| -rw-r--r-- | internal/game/casino.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/game/casino.go b/internal/game/casino.go index 0441903..5268d34 100644 --- a/internal/game/casino.go +++ b/internal/game/casino.go @@ -105,13 +105,25 @@ func (w casinoWallet) payCreditsFlagged(amount int, refund bool) error { return capErr } w.p.Credits = creditsAfter + // Record the payout in the character's open-payout evidence list: the + // save below is the commit point, and the file itself then proves the + // amount is included in the balance. Recovery reads this list instead + // of guessing from balance checkpoints, which unrelated credit changes + // (a shop sale, a bank deposit) can replicate by coincidence. + w.p.OpenPayouts = append(w.p.OpenPayouts, rec.ID) if err := w.g.AccountStore.SaveCharacter(w.p); err != nil { w.p.Credits = creditsBefore + removeOpenPayout(w.p, rec.ID) // Keep the record open: recovery re-pays on next startup, since a // reported win must be durable. return casino.ErrWalletPersistence } - w.g.Economy.settle(rec) + // The evidence entry may only be dropped once the settled marker is + // durable; while the marker is still open, the file's membership is + // what proves durability to recovery. + if w.g.Economy.settleDurable(rec) { + removeOpenPayout(w.p, rec.ID) + } return nil } |
