From 8fe9e3c3fef0049df82281a62afe35dda516dfe2 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 17:48:26 -0400 Subject: fix: close combat ghost, admin traversal, login throttle, journal double-pay, and quality/economy gaps --- internal/game/session_registry.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/game/session_registry.go') diff --git a/internal/game/session_registry.go b/internal/game/session_registry.go index c4f5d67..cf4e8df 100644 --- a/internal/game/session_registry.go +++ b/internal/game/session_registry.go @@ -23,3 +23,17 @@ func (g *Game) detachSession(name string) { g.queue.ClearPlayer(name) } } + +// sessionRegistered reports whether sess is still the live session for name. +// Tick subscribers that can outlive a disconnect/re-login must consult this +// before acting on a session that is no longer in the world (a detached +// combat or logout subscriber would otherwise keep saving a ghost). +func (g *Game) sessionRegistered(sess *net.Session, name string) bool { + if sess == nil || sess.Player == nil { + return false + } + g.charsMu.Lock() + current := g.loggedInChars[name] + g.charsMu.Unlock() + return current == sess +} -- cgit v1.2.3