aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_sneak.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/cmd_sneak.go')
-rw-r--r--internal/game/cmd_sneak.go15
1 files changed, 15 insertions, 0 deletions
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)
}