From 1f118d79e319da4e765502e9ca5b661772de94f1 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 18:38:35 -0400 Subject: refactor: casino table core; fix: stake/migration/validation gaps --- internal/game/sys_safespot_state.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'internal/game/sys_safespot_state.go') diff --git a/internal/game/sys_safespot_state.go b/internal/game/sys_safespot_state.go index 1520bc7..32f57ec 100644 --- a/internal/game/sys_safespot_state.go +++ b/internal/game/sys_safespot_state.go @@ -67,6 +67,22 @@ func (m *SafespotManager) Delete(name string) bool { return ok } +// RekeyRooms remaps the stored RoomID of every safespot per idMap so a live +// room rename does not orphan a player's cover (the safespot lookup keys on +// the room ID and force-ejects on a miss). +func (m *SafespotManager) RekeyRooms(idMap map[int]int) { + if len(idMap) == 0 { + return + } + m.mu.Lock() + defer m.mu.Unlock() + for _, ss := range m.states { + if newID, ok := idMap[ss.RoomID]; ok && newID != ss.RoomID { + ss.RoomID = newID + } + } +} + // DecrementHideCountdown decrements the hide countdown for a player who is // transitioning from hiding to hidden. Returns (newCountdown, ok). A return of // ok=true with newCountdown > 0 means the player is still counting down; -- cgit v1.2.3