]> granicus.if.org Git - nethack/commitdiff
cmdassist enhancement
authornethack.rankin <nethack.rankin>
Sat, 10 Jan 2004 03:23:55 +0000 (03:23 +0000)
committernethack.rankin <nethack.rankin>
Sat, 10 Jan 2004 03:23:55 +0000 (03:23 +0000)
     Implement the patch sent by <email deleted>
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
src/cmd.c

index b4de9d8d201c043ea5ae324477eb3ea78568aff9..b7ec3aaf561da9b3708df4659c96456af4429ea6 100644 (file)
@@ -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
index 98cab5587d53c69e3f3bcf64bed5dd2339fc3371..54824a0f21ee6513cef51060c4cbd10ca4d43358 100644 (file)
--- 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;
 }