diff options
| author | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 17:48:26 -0400 |
| commit | 8fe9e3c3fef0049df82281a62afe35dda516dfe2 (patch) | |
| tree | dd269f2c0710f334e19f00a191260ebc46284a90 /internal/game/session_registry.go | |
| parent | 194164a77eb4f2479b94c19e6f0e1278ab608781 (diff) | |
| download | thehouseoficarus-8fe9e3c3fef0049df82281a62afe35dda516dfe2.tar.gz | |
fix: close combat ghost, admin traversal, login throttle, journal double-pay, and quality/economy gaps
Diffstat (limited to 'internal/game/session_registry.go')
| -rw-r--r-- | internal/game/session_registry.go | 14 |
1 files changed, 14 insertions, 0 deletions
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 +} |
