aboutsummaryrefslogtreecommitdiff
path: root/internal/game/sys_safespot_state.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 18:38:35 -0400
committerhistoria <[not public]>2026-09-18 18:38:35 -0400
commit1f118d79e319da4e765502e9ca5b661772de94f1 (patch)
treebca8a3fd1e538f1c302480511e6ba872c92e10b8 /internal/game/sys_safespot_state.go
parent5ad42a51df4dcc5ccc3aa6a6d902085ce2ee4239 (diff)
downloadthehouseoficarus-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.go16
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;