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.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/internal/game/cmd_quit.go b/internal/game/cmd_quit.go
index 0a8b8ca..50f1ec5 100644
--- a/internal/game/cmd_quit.go
+++ b/internal/game/cmd_quit.go
@@ -92,7 +92,10 @@ func (g *Game) beginQuitCountdown(sess *net.Session) {
case 3:
sess.WriteLine("You close your eyes...")
case 0:
- g.cancelRest(p.Name)
+ // Release combat, cover, actions and hacking state before the
+ // disconnect. This path used to leave the character occupying a
+ // safespot cover after logging out.
+ g.releaseCharacterRuntime(sess, p)
g.restoreGodPlayer(p)
// Forfeit any committed casino wager and free the seat only
// now — immediately before the disconnect. Settling games only
@@ -101,16 +104,10 @@ func (g *Game) beginQuitCountdown(sess *net.Session) {
g.emitCasinoEvents(g.Casino.MarkDisconnected(p.Name))
}
g.saveCharacter(p)
- 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)
- }
+ // Drop the registry entry and any queued commands: leftover queue
+ // entries retain this session and would replay on a later login as
+ // the same character.
+ g.detachSession(p.Name)
if g.Hub != nil {
g.Hub.LeaveRoom(sess)
}