From 0b0b25222b3131ada79ff78c28eb8bf07d977deb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 15 Sep 2026 15:35:52 -0400 Subject: feat: single-owner game state, transactional lifecycle, durable money on server stop --- internal/game/session_registry.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 internal/game/session_registry.go (limited to 'internal/game/session_registry.go') diff --git a/internal/game/session_registry.go b/internal/game/session_registry.go new file mode 100644 index 0000000..0e47f82 --- /dev/null +++ b/internal/game/session_registry.go @@ -0,0 +1,19 @@ +package game + +import "thehouseoficarus/internal/net" + +// attachSession registers a fully-logged-in session in the game's +// character registry. Menu flows call it through connectCharacter; the test +// harness uses it to skip the menu. +func (g *Game) attachSession(sess *net.Session) { + g.charsMu.Lock() + g.loggedInChars[sess.Player.Name] = sess + g.charsMu.Unlock() +} + +// detachSession removes a character's registry entry. +func (g *Game) detachSession(name string) { + g.charsMu.Lock() + delete(g.loggedInChars, name) + g.charsMu.Unlock() +} -- cgit v1.2.3