]> granicus.if.org Git - nethack/commitdiff
post-3.6 bug: scrambled dip message
authorPatR <rankin@nethack.org>
Mon, 15 Mar 2021 08:10:39 +0000 (01:10 -0700)
committerPatR <rankin@nethack.org>
Mon, 15 Mar 2021 08:10:39 +0000 (01:10 -0700)
Reported directly to devteam:  constructing a verb by applying
"ing" to "dip <item> into" (when attempting to dip into '-')
didn't work too well.  It yielded
 |You mime dip <item> intoing something.
instead of
 |You mime dipping <item> into something.

doc/fixes37.0
src/invent.c

index 3ad38a9ae900d787f3b7cd5032a4c29638f95f9e..f5607fca2977faec77f36579cdbb83bf9bc6b9b4 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.475 $ $NHDT-Date: 1615760296 2021/03/14 22:18:16 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.476 $ $NHDT-Date: 1615794750 2021/03/15 07:52:30 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -538,6 +538,8 @@ change wizard mode command #wizmgender to wizard mode option 'wizmgender'
 engraving with non-blade dulled the weapon anyway (pr #464)
 'sortdiscoveries:s' had a spurious generic header shown at the start of the
        last class if there were any artifacts or unique items discovered
+after getobj refactor: "#dip <item> into -" produced a scrambled message:
+       You mime dip <item> intoing something.
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index f0b0fd06e5f59ccb605af3d59629a381c6565c21..81754ac5dc12a96f8dce2e6e84f54cec2f8109a6 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 invent.c        $NHDT-Date: 1614474790 2021/02/28 01:13:10 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.320 $ */
+/* NetHack 3.7 invent.c        $NHDT-Date: 1615794750 2021/03/15 07:52:30 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.324 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1413,22 +1413,29 @@ static void
 mime_action(const char *word)
 {
     char buf[BUFSZ];
-    char *bp = buf;
-    char *suf = (char *) 0;
+    char *bp, *pfx, *sfx;
+
+    Strcpy(buf, word);
+    bp = pfx = sfx = (char *) 0;
 
-    strcpy(buf, word);
     if ((bp = strstr(buf, " on the ")) != 0) {
         /* rub on the stone[s] */
         *bp = '\0';
-        suf = (bp + 1);
+        sfx = (bp + 1); /* "something <sfx>" */
+    }
+    if (!strncmp(buf, "dip ", 4) && strstr(buf + 4, " into")) {
+        /* "dip <foo> into" => "dipping <foo> into" */
+        buf[3] = '\0';
+        pfx = &buf[4]; /* "<pfx> something" */
     }
     if ((bp = strstr(buf, " or ")) != 0) {
         *bp = '\0';
         bp = (rn2(2) ? buf : (bp + 4));
     } else
         bp = buf;
-    You("mime %s something%s%s.", ing_suffix(bp), suf ? " " : "",
-        suf ? suf : "");
+
+    You("mime %s%s%s something%s%s.", ing_suffix(bp),
+        pfx ? " " : "", pfx ? pfx : "", sfx ? " " : "", sfx ? sfx : "");
 }
 
 /* getobj callback that allows any object - but not hands. */