diff options
| author | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
| commit | 1f118d79e319da4e765502e9ca5b661772de94f1 (patch) | |
| tree | bca8a3fd1e538f1c302480511e6ba872c92e10b8 /internal/game/sys_safespot_state.go | |
| parent | 5ad42a51df4dcc5ccc3aa6a6d902085ce2ee4239 (diff) | |
| download | thehouseoficarus-1f118d79e319da4e765502e9ca5b661772de94f1.tar.gz | |
refactor: casino table core; fix: stake/migration/validation gaps
Diffstat (limited to 'internal/game/sys_safespot_state.go')
| -rw-r--r-- | internal/game/sys_safespot_state.go | 16 |
1 files changed, 16 insertions, 0 deletions
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; |
