aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_stop.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_stop.go')
-rw-r--r--internal/game/cmd_stop.go15
1 files changed, 5 insertions, 10 deletions
diff --git a/internal/game/cmd_stop.go b/internal/game/cmd_stop.go
index 5c347e6..b05e1fc 100644
--- a/internal/game/cmd_stop.go
+++ b/internal/game/cmd_stop.go
@@ -6,16 +6,11 @@ import (
func (g *Game) executeStop(sess *net.Session, args []string, rawInput string) {
p := sess.Player
- if table, playing := g.Casino.Participation(p.Name); playing {
- if table != nil {
- g.emitCasinoEvents(g.Casino.Leave(table.RoomID, table.Config.ID, p.Name))
- } else if machine, ok := g.Casino.MachineFor(p.Name); ok {
- if events, stopped := g.Casino.StopMachineAutoBet(machine.RoomID, machine.Config.ID, p.Name); stopped {
- g.emitCasinoEvents(events)
- return
- }
- g.emitCasinoEvents(g.Casino.LeaveMachine(machine.RoomID, machine.Config.ID, p.Name))
- }
+ // "stop" is an instant command, so it executes outside the command
+ // queue; cancel a pending quit countdown explicitly.
+ g.cancelRest(p.Name)
+ if _, playing := g.Casino.Participation(p.Name); playing {
+ g.leaveCasinoGames(sess, p)
return
}
ss, _ := g.safespot.Get(p.Name)