diff options
| author | historia <[not public]> | 2026-07-07 00:22:32 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-07 00:22:32 -0400 |
| commit | a51f7a53aa2c487ebf94ba0363038574ae8bb590 (patch) | |
| tree | b393a8f9e4732b40f6fe8058d086bd631537ad3b /internal/game/exit_discovery.go | |
| parent | 9292634f2f8d71a53879ff07e1330c671b207d51 (diff) | |
| download | thehouseoficarus-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.go | 15 |
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) -} |
