]> granicus.if.org Git - nethack/commitdiff
'm ^V' (aka 'm C-v')
authorPatR <rankin@nethack.org>
Mon, 9 Apr 2018 20:48:43 +0000 (13:48 -0700)
committerPatR <rankin@nethack.org>
Mon, 9 Apr 2018 20:48:43 +0000 (13:48 -0700)
Allow the 'm' prefix for wizard mode level teleport command.  Using
it skips the initial prompt for level destination and goes directly
to the menu of special level locations that you get when answering
'?' to that prompt.

doc/fixes36.1
src/cmd.c
src/teleport.c

index f30c4e0aa597d318497363c639b00befc071aae0..37a7ce57cbdcffc04b245b8d73f83136de913f8e 100644 (file)
@@ -827,6 +827,8 @@ a prayer result which results in uncursing some or all of the hero's items
 wielded aklys behaves like Mjollnir when thrown--it usually returns; unlike
        Mjollnir, it isn't limited to Valkyries or need gauntlets of power
        (so far, hero-only; an aklys won't return if thrown by a monster)
+allow 'm' prefix for wizard mode level teleport command (^V) to bypass prompt
+       for destination and use menu of special level locations
 
 
 Platform- and/or Interface-Specific New Features
index 22496dd55edf5a7a57b7c6779b5b55c549621144..2189468641e70f86274a68657e1f91d4615634df 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 cmd.c   $NHDT-Date: 1518861485 2018/02/17 09:58:05 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.278 $ */
+/* NetHack 3.6 cmd.c   $NHDT-Date: 1523306904 2018/04/09 20:48:24 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.281 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -4049,6 +4049,8 @@ int NDECL((*cmd_func));
         || cmd_func == doloot
         /* travel: pop up a menu of interesting targets in view */
         || cmd_func == dotravel
+        /* wizard mode ^V */
+        || cmd_func == wiz_level_tele
         /* 'm' prefix allowed for some extended commands */
         || cmd_func == doextcmd || cmd_func == doextlist)
         return TRUE;
index 0a931205c54fecec98b74310f554e13fe69c6bc2..53516977f4a4d69729f59f2b67df0b1f508f1f78 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 teleport.c      $NHDT-Date: 1455140444 2016/02/10 21:40:44 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.66 $ */
+/* NetHack 3.6 teleport.c      $NHDT-Date: 1523306912 2018/04/09 20:48:32 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.73 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -595,7 +595,7 @@ level_tele()
     register int newlev;
     d_level newlevel;
     const char *escape_by_flying = 0; /* when surviving dest of -N */
-    char buf[BUFSZ] = DUMMY;
+    char buf[BUFSZ];
     boolean force_dest = FALSE;
 
     if ((u.uhave.amulet || In_endgame(&u.uz) || In_sokoban(&u.uz))
@@ -609,12 +609,22 @@ level_tele()
 
         Strcpy(qbuf, "To what level do you want to teleport?");
         do {
+            if (iflags.menu_requested) {
+                /* wizard mode 'm ^V' skips prompting on first pass
+                   (note: level Tport via menu won't have any second pass) */
+                iflags.menu_requested = FALSE;
+                if (wizard)
+                    goto levTport_menu;
+            }
             if (++trycnt == 2) {
                 if (wizard)
                     Strcat(qbuf, " [type a number, name, or ? for a menu]");
                 else
                     Strcat(qbuf, " [type a number or name]");
             }
+            *buf = '\0'; /* EDIT_GETLIN: if we're on second or later pass,
+                            the previous input was invalid so don't use it
+                            as getlin()'s preloaded default answer */
             getlin(qbuf, buf);
             if (!strcmp(buf, "\033")) { /* cancelled */
                 if (Confusion && rnl(5)) {
@@ -629,9 +639,12 @@ level_tele()
                 goto random_levtport;
             }
             if (wizard && !strcmp(buf, "?")) {
-                schar destlev = 0;
-                xchar destdnum = 0;
+                schar destlev;
+                xchar destdnum;
 
+            levTport_menu:
+                destlev = 0;
+                destdnum = 0;
                 newlev = (int) print_dungeon(TRUE, &destlev, &destdnum);
                 if (!newlev)
                     return;