aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_quit.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_quit.go')
-rw-r--r--internal/game/cmd_quit.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/internal/game/cmd_quit.go b/internal/game/cmd_quit.go
index 80ad351..24519f8 100644
--- a/internal/game/cmd_quit.go
+++ b/internal/game/cmd_quit.go
@@ -12,16 +12,19 @@ func (g *Game) executeQuit(sess *net.Session, args []string, rawInput string) {
func (g *Game) doQuit(sess *net.Session) {
p := sess.Player
- // Combat blocks quitting outright; check it before forfeiting any casino
- // wager so a cancelled quit never costs the player their round.
+ // Combat blocks quitting outright; check it before departing any casino
+ // game so a cancelled quit never costs the player their round.
if g.Combat.Get(p.Name) != nil {
sess.WriteLine("You can't rest during combat!")
return
}
- if _, playing := g.Casino.Participation(p.Name); playing {
- sess.WriteLine(g.colorize(sess, "warning", "WARNING: You're in the middle of a game!"))
- g.emitCasinoEvents(g.Casino.MarkDisconnected(p.Name))
+ // Depart casino games the way "stop" does: a table with a wager committed
+ // to the round in flight refuses and the quit is aborted, so deliberate
+ // exits never forfeit a stake or reveal cards mid-hand. Forfeit-on-leave
+ // stays reserved for genuine disconnects (hub.OnDisconnect).
+ if !g.leaveCasinoGames(sess, p) {
+ return
}
g.cancelAction(p)