From 0e60567a7a0addb9421769ee7be7853bfa8788cb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 19 Sep 2026 03:15:59 -0400 Subject: refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code --- internal/game/cmd_sneak.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'internal/game/cmd_sneak.go') diff --git a/internal/game/cmd_sneak.go b/internal/game/cmd_sneak.go index 5ae60e7..ce063ce 100644 --- a/internal/game/cmd_sneak.go +++ b/internal/game/cmd_sneak.go @@ -2,10 +2,25 @@ package game import ( "fmt" + "strconv" + "strings" "thehouseoficarus/internal/net" ) +// clearGuardWatchRoom drops the sneak/guard-watch cycle timers for one room. +// Called when the room's content is reconciled or the room is deleted, so the +// map does not retain entries for rooms/objects that no longer exist for the +// life of the process. +func (g *Game) clearGuardWatchRoom(roomID int) { + prefix := strconv.Itoa(roomID) + ":" + for key := range g.guardWatchTimers { + if strings.HasPrefix(key, prefix) { + delete(g.guardWatchTimers, key) + } + } +} + func (g *Game) executeSneak(sess *net.Session, args []string, rawInput string) { g.doSneak(sess) } -- cgit v1.2.3