aboutsummaryrefslogtreecommitdiff
path: root/internal/game/exit_discovery.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-07 00:22:32 -0400
committerhistoria <[not public]>2026-07-07 00:22:32 -0400
commita51f7a53aa2c487ebf94ba0363038574ae8bb590 (patch)
treeb393a8f9e4732b40f6fe8058d086bd631537ad3b /internal/game/exit_discovery.go
parent9292634f2f8d71a53879ff07e1330c671b207d51 (diff)
downloadthehouseoficarus-a51f7a53aa2c487ebf94ba0363038574ae8bb590.tar.gz
feat: hidden exits (and related flags) work with commands that change room ids. exit code simplified and unified between impassable and blocked exits.
Diffstat (limited to 'internal/game/exit_discovery.go')
-rw-r--r--internal/game/exit_discovery.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/game/exit_discovery.go b/internal/game/exit_discovery.go
index 1d07e13..cf09252 100644
--- a/internal/game/exit_discovery.go
+++ b/internal/game/exit_discovery.go
@@ -8,8 +8,14 @@ import (
"thehouseoficarus/internal/world"
)
+// hiddenExitFlagPrefix is the canonical prefix for discovered-exit player flags
+// ("hidden_exit_<roomID>_<dir>"). Shared by discoveredExitFlag, the
+// hideallexits admin command, and the room-ID migration in exit_migrate.go so
+// the format never drifts between writers and readers.
+const hiddenExitFlagPrefix = "hidden_exit_"
+
func discoveredExitFlag(roomID int, dir world.ExitDir) string {
- return fmt.Sprintf("hidden_exit_%d_%s", roomID, strings.ToLower(string(dir)))
+ return fmt.Sprintf("%s%d_%s", hiddenExitFlagPrefix, roomID, strings.ToLower(string(dir)))
}
func (g *Game) exitDiscovered(p *player.Player, roomID int, dir world.ExitDir) bool {
@@ -22,10 +28,3 @@ func (g *Game) exitDiscovered(p *player.Player, roomID int, dir world.ExitDir) b
func (g *Game) markExitDiscovered(p *player.Player, roomID int, dir world.ExitDir) {
g.setPlayerFlag(p, discoveredExitFlag(roomID, dir), 1)
}
-
-func (g *Game) exitHiddenFiltered(p *player.Player, roomID int, dir world.ExitDir, exitHidden bool) bool {
- if !exitHidden {
- return true
- }
- return g.exitDiscovered(p, roomID, dir)
-}