dipping fix

If you used 'm #dip' to skip being asked about dipping into a
fountain, sink, or pool and go directly to being prompted for which
potion to dip something into, formatting for the thing being dipped
was skipped.  If 'verbose' was On, an uninitialized buffer was
inserted into "dip [] into?" for use by getobj().  Could cause a
crash (prior to a commit made earlier today) but if it didn't, it
would only be noticable to players who leave 'force_invmenu' Off.
This commit is contained in:
PatR
2024-09-14 16:34:22 -07:00
parent 5bb4adace0
commit b37d0af41e
+5 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.7 potion.c $NHDT-Date: 1716668700 2024/05/25 20:25:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.265 $ */
/* NetHack 3.7 potion.c $NHDT-Date: 1726356849 2024/09/14 23:34:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.270 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2261,9 +2261,6 @@ dodip(void)
shortestname = (is_hands || is_plural(obj) || pair_of(obj)) ? "them"
: "it";
drink_ok_extra = 0;
/* preceding #dip with 'm' skips the possibility of dipping into pools,
fountains, and sinks plus the extra prompting which those entail */
if (!iflags.menu_requested) {
/*
* Bypass safe_qbuf() since it doesn't handle varying suffix without
* an awful lot of support work. Format the object once, even though
@@ -2274,8 +2271,7 @@ dodip(void)
* getobj: "What do you want to dip <the object> into? [xyz or ?*] "
*/
if (is_hands) {
Snprintf(obuf, sizeof(obuf), "your %s",
makeplural(body_part(HAND)));
Snprintf(obuf, sizeof obuf, "your %s", makeplural(body_part(HAND)));
} else {
Strcpy(obuf, short_oname(obj, doname, thesimpleoname,
/* 128 - (24 + 54 + 1) leaves 49 for
@@ -2284,6 +2280,9 @@ dodip(void)
into? [abdeghjkmnpqstvwyzBCEFHIKLNOQRTUWXZ#-# or ?*] "));
}
/* preceding #dip with 'm' skips the possibility of dipping into pools,
fountains, and sinks plus the extra prompting which those entail */
if (!iflags.menu_requested) {
/* Is there a fountain to dip into here? */
if (!can_reach_floor(FALSE)) {
; /* can't dip something into fountain or pool if can't reach */