aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_quit.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/game/cmd_quit.go
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/game/cmd_quit.go')
-rw-r--r--internal/game/cmd_quit.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/game/cmd_quit.go b/internal/game/cmd_quit.go
index f8075c1..bf46748 100644
--- a/internal/game/cmd_quit.go
+++ b/internal/game/cmd_quit.go
@@ -30,7 +30,14 @@ func (g *Game) doQuit(sess *net.Session) {
// exits never forfeit a stake or reveal cards mid-hand. Forfeit-on-leave
// stays reserved for genuine disconnects and "quit now".
if !g.leaveCasinoGames(p) {
- sess.WriteLine(g.colorize(sess, "warning", "Type \"quit now\" to log out anyway — your bet will be forfeited."))
+ // A committed wager blocks the departure; whether it is actually lost
+ // depends on whether the game has dealt/started a round for it. A
+ // stake the game has not dealt for yet is refunded on disconnect
+ // (baccarat always, blackjack while the betting window is open), and
+ // a dealt hand or a spin in progress is forfeited. The refusal
+ // therefore states both outcomes instead of promising a forfeit that
+ // an undealt stake does not suffer.
+ sess.WriteLine(g.colorize(sess, "warning", "Type \"quit now\" to log out anyway — a bet still awaiting the deal is refunded; a hand or spin in progress is forfeited."))
return
}
@@ -86,6 +93,13 @@ func (g *Game) beginQuitCountdown(sess *net.Session) {
g.charsMu.Lock()
delete(g.loggedInChars, p.Name)
g.charsMu.Unlock()
+ // The character is leaving the world: drop its queued free/
+ // active/consume commands with the registry entry, or they
+ // retain this session and replay on a later login as the same
+ // character.
+ if g.queue != nil {
+ g.queue.ClearPlayer(p.Name)
+ }
if g.Hub != nil {
g.Hub.LeaveRoom(sess)
}