From 8d6f610b37e786155fdcd03a20187ca2735998a5 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sat, 10 Jan 2004 03:23:55 +0000 Subject: [PATCH] cmdassist enhancement Implement the patch sent by to make responding with '?' at the "what direction?" prompt ask again after giving the `cmdassist' direction display. I did it slightly differently than was done in the submitted patch but the result is the same except that it also suppresses the message about how to disable cmdassist in this case. --- doc/fixes34.4 | 1 + src/cmd.c | 33 +++++++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index b4de9d8d2..b7ec3aaf5 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -22,6 +22,7 @@ Platform- and/or Interface-Specific Fixes General New Features -------------------- when you're teetering on the edge of a pit you can use '>' to enter the pit +when asked for a direction, a response of '?' yields help and then asks again Platform- and/or Interface-Specific New Features diff --git a/src/cmd.c b/src/cmd.c index 98cab5587..54824a0f2 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)cmd.c 3.4 2003/04/02 */ +/* SCCS Id: @(#)cmd.c 3.4 2004/01/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2084,30 +2084,35 @@ const char *s; { char dirsym; + retry: #ifdef REDO - if(in_doagain || *readchar_queue) + if (in_doagain || *readchar_queue) dirsym = readchar(); else #endif - dirsym = yn_function ((s && *s != '^') ? s : "In what direction?", + dirsym = yn_function((s && *s != '^') ? s : "In what direction?", (char *)0, '\0'); #ifdef REDO savech(dirsym); #endif - if(dirsym == '.' || dirsym == 's') - u.dx = u.dy = u.dz = 0; - else if(!movecmd(dirsym) && !u.dz) { - boolean did_help = FALSE; - if(!index(quitchars, dirsym)) { - if (iflags.cmdassist) { - did_help = help_dir((s && *s == '^') ? dirsym : 0, + if (dirsym == '.' || dirsym == 's') { + u.dx = u.dy = u.dz = 0; + } else if (!movecmd(dirsym) && !u.dz) { + boolean did_help = FALSE, help_requested; + + if (!index(quitchars, dirsym)) { + help_requested = (dirsym == '?'); + if (help_requested || iflags.cmdassist) { + did_help = help_dir((s && *s == '^') ? dirsym : 0, + help_requested ? (const char *)0 : "Invalid direction key!"); - } - if (!did_help) pline("What a strange direction!"); + if (help_requested) goto retry; } - return 0; + if (!did_help) pline("What a strange direction!"); + } + return 0; } - if(!u.dz && (Stunned || (Confusion && !rn2(5)))) confdir(); + if (!u.dz && (Stunned || (Confusion && !rn2(5)))) confdir(); return 1; }