Missing command: '+' wizard-mode toggle-off answers "illegal command" #11
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
C
command.c:316-336has acase '+'that toggles wizard mode:turn_see(TRUE), prints"not wizard any more"
passwd()Go's
commandHandlers(game/tables.go:697…) has no'+'entry, andneither
wizardCommandnorwizardDebugCommand(game/command.go:395-446)handles it. So in wizard mode, pressing
+falls through toillcomandprints "illegal command '+'".
The password half was correctly and deliberately dropped (wizard mode is now
gated on
ROGUE_WIZARD, documented in ARCHITECTURE.md §9 andgame/wizard.go:5-6). But the toggle-off half was lost silently — it isnot mentioned in the dropped-functionality table, and it does not depend on
the password machinery at all.
The
turn_see(TRUE)call is the substantive part: leaving wizard mode has tore-hide monsters that wizard sight revealed. Without it there is no way back
to normal visibility once wizard mode is on.
Definition of done
'+'is handled in wizard mode: wizard flag cleared, the equivalent ofC's
turn_see(TRUE)performed, and C's exact message text emitted.dropped — pressing
+as a normal player must do whatever C'snow-unreachable-for-us branch would sensibly reduce to; state the choice in
a code comment).
+through command dispatch in wizard mode and asserts theflag is cleared and previously-wizard-visible monsters are hidden again.
'+'remains deliberatelydropped.
make checkfully green.TODO.mdupdated in the same commit.(closes #N).Implementation requirements
git show origin/c-master:command.c(thecase '+'arm) and theturn_seeimplementation before writing anything. Do NOT check out ormodify
origin/c-master.contract in this repo.
(command.c ...)).t.Parallel()and the//nolint:testpackageheader.maketargets only. Do NOT modify.golangci.yml.Premises verified against the C reference
Checked before writing anything; all substantive claims hold.
git show origin/c-master:command.clines 317-338: the arm is spelledwhen '+':(thewhenmacro isbreak; case), wrapped in#ifdef MASTER. The issue cites 316-336; the real range is 317-338(
#ifdef MASTER317,when '+':318,#endif338). Cosmetic drift only.Both arms are exactly as described:
turn_seelives inpotions.c(declaredrogue.h:691). Theturn_offarm redraws
t_oldchat every monster the hero cannot see and clearsSEEMONST; it consumes no random numbers (only the turn-on arm callsrnd). Go already has a faithfulturnSeeingame/potions.go:295,used by
newlevel.go,potions.goand the wizard^Xcommand.Go really has no
'+': not incommandHandlers(game/tables.go), notin
wizardCommand/wizardDebugCommand(game/command.go:402-454). Theonly
'+'literals in non-test code areDoor(types.go:48) and theblessing prompt in
wizard.go. So'+'reachesdispatchKey's defaultand ends at
illcom.One correction to the framing, which changes where the code goes:
'+'sitsin C's main command switch (just before
otherwise:), not in theif (wizard) switch (ch)sub-switch thatwizardCommandports. UnderMASTERC therefore reaches it whether or notwizardis set, so the Gohome is
commandHandlers, notwizardCommand. That also means thenon-wizard behaviour is a divergence today too: C answers "sorry", Go
answers "illegal command '+'".
Plan
game/command.go: newwizardToggleCommand, breadcrumbed(command.c command). SetsAfter = false; wheng.Wizard, clears theflag, calls
g.turnSee(true), and emits"not wizard any more"verbatim; otherwise emits
"sorry".passwd()isdropped (wizard mode is
ROGUE_WIZARDconfiguration, ARCHITECTURE.md§9), and a dropped password check is a password check that never
succeeds, so the else arm reduces to exactly what C did on a wrong
password —
wizardstays off, message"sorry". No prompt isshown, since nothing typed into it could change the outcome.
noscoreand
turn_see(FALSE)belong to the unreachable success branch and arenot ported.
game/tables.go:'+': (*RogueGame).wizardToggleCommandincommandHandlers.game/wizard_test.go:'+'driven throughg.dispatchin wizard modewith a sensed-but-unseeable monster (an invisible phantom, so
seeMonstis false) after
turnSee(false). Asserts the precondition (monster glyphdrawn in standout at its cell,
SenseMonstersset), then after'+':Wizardfalse,SenseMonsterscleared, and the cell back to themonster's
OldChwith standout off — the visibility half is thereal assertion. Plus the message text and a second test for the
not-in-wizard-mode
"sorry"arm.amended to name the
'+'enter arm as the dropped part and to recordthat the leave arm is ported and the else arm answers "sorry".
TODO.mdCompleted Steps entry in the same commit;Next Stepnotrotated (out-of-band issue work).
RNG order is untouched:
turnSee(true)makes norndcall, and the new keyis additive to the dispatch map.
TestSeedCompatItemTablesstays greenagainst the untouched golden.
clawbot referenced this issue2026-08-09 17:43:36 +02:00