From: PatR Date: Mon, 15 Mar 2021 08:10:39 +0000 (-0700) Subject: post-3.6 bug: scrambled dip message X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98d381de46c47325abbdafda7894238c59f18cb8;p=nethack post-3.6 bug: scrambled dip message Reported directly to devteam: constructing a verb by applying "ing" to "dip into" (when attempting to dip into '-') didn't work too well. It yielded |You mime dip intoing something. instead of |You mime dipping into something. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 3ad38a9ae..f5607fca2 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 into -" produced a scrambled message: + You mime dip intoing something. curses: 'msg_window' option wasn't functional for curses unless the binary also included tty support diff --git a/src/invent.c b/src/invent.c index f0b0fd06e..81754ac5d 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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 " */ + } + if (!strncmp(buf, "dip ", 4) && strstr(buf + 4, " into")) { + /* "dip into" => "dipping into" */ + buf[3] = '\0'; + pfx = &buf[4]; /* " 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. */