aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/machine.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-19 01:55:34 -0400
committerhistoria <[not public]>2026-09-19 01:55:34 -0400
commitcc33072eced3d5460512c09c42ec4531c807d7af (patch)
treeb1b451fa87fa389cb8343a3645372f3b43f5523e /internal/casino/machine.go
parent2c38386484cdb507c4687caceb37e0b963e33594 (diff)
downloadthehouseoficarus-cc33072eced3d5460512c09c42ec4531c807d7af.tar.gz
fix: casino stake preservation, world state reconciliation, casino game registration
Diffstat (limited to 'internal/casino/machine.go')
-rw-r--r--internal/casino/machine.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/internal/casino/machine.go b/internal/casino/machine.go
index 97b846d..7821975 100644
--- a/internal/casino/machine.go
+++ b/internal/casino/machine.go
@@ -402,12 +402,23 @@ func (m *Machine) markDisconnected(name string) []Event {
if !m.owns(name) {
return nil
}
+ // A spin whose reels have all stopped has already been revealed to the
+ // player, so its result is final. Settle it through the normal path
+ // before the seat is reset: otherwise a disconnect during the cosmetic
+ // payout delay forfeits an already-shown win and consumes the stake for a
+ // spin the player watched land. finishSpin consumes the stake itself on a
+ // resolved round (or banks a feature win), so resetSeat below neither
+ // double-pays nor double-consumes.
+ var events []Event
+ if m.phase == machinePayout && m.spin != nil {
+ events = append(events, m.finishSpin()...)
+ }
bank := int(m.featureBank)
wallet := m.player.Wallet
stakeFailed := m.stakeFailed
m.resetSeat()
- events := []Event{{RoomID: m.RoomID, TableID: m.Config.ID, Type: EventLeft, Player: name,
- Message: fmt.Sprintf("%s stands up from the slots machine.", name), Color: "casino_action", Public: true}}
+ events = append(events, Event{RoomID: m.RoomID, TableID: m.Config.ID, Type: EventLeft, Player: name,
+ Message: fmt.Sprintf("%s stands up from the slots machine.", name), Color: "casino_action", Public: true})
if bank <= 0 || wallet == nil {
return events
}