From: PatR Date: Mon, 21 Dec 2015 03:11:36 +0000 (-0800) Subject: H4047 revisited - dipping prompts X-Git-Tag: NetHack-3.6.1_RC01~1134 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31486e23cf6440bac58da954807532cc0f3d3d4e;p=nethack H4047 revisited - dipping prompts Shorten the dip-into-fountain, dip-into-pool, and dip-into-potion prompts when flags.verbose is off. For non-verbose, use "it" (or "them") instead of the formatted object name of the item being dipped. Also, the "What do you want to dip into?? [xyz or ?*]" prompt for dipping into a potion had an extra question mark. I must have seen that umpteen times before it actually registered. No fixes entry; these are changes to post-3.6.0 changes.... --- diff --git a/src/potion.c b/src/potion.c index 6bdbc7702..2631955b5 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 potion.c $NHDT-Date: 1450660662 2015/12/21 01:17:42 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.123 $ */ +/* NetHack 3.6 potion.c $NHDT-Date: 1450667491 2015/12/21 03:11:31 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.124 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1754,6 +1754,7 @@ register struct obj *o1, *o2; int dodip() { + static const char Dip_[] = "Dip ", into_the_something[] = " into the %s?"; register struct obj *potion, *obj; struct obj *singlepotion; uchar here; @@ -1773,19 +1774,28 @@ dodip() here = levl[u.ux][u.uy].typ; /* Is there a fountain to dip into here? */ if (IS_FOUNTAIN(here)) { + Sprintf(qtoo, into_the_something, "fountain"); + if (flags.verbose) + (void) safe_qbuf(qbuf, Dip_, qtoo, obj, + doname, thesimpleoname, shortestname); + else + Sprintf(qbuf, "%s%s%s", Dip_, shortestname, qtoo); /* "Dip into the fountain?" */ - if (yn(safe_qbuf(qbuf, "Dip ", " into the fountain?", obj, - doname, thesimpleoname, shortestname)) == 'y') { + if (yn(qbuf) == 'y') { dipfountain(obj); return 1; } } else if (is_pool(u.ux, u.uy)) { const char *pooltype = waterbody_name(u.ux, u.uy); + Sprintf(qtoo, into_the_something, pooltype); + if (flags.verbose) + (void) safe_qbuf(qbuf, Dip_, qtoo, obj, + doname, thesimpleoname, shortestname); + else + Sprintf(qbuf, "%s%s%s", Dip_, shortestname, qtoo); /* "Dip into the {pool, moat, &c}?" */ - Sprintf(qtoo, " into the %s?", pooltype); - if (yn(safe_qbuf(qbuf, "Dip ", qtoo, obj, - doname, thesimpleoname, shortestname)) == 'y') { + if (yn(qbuf) == 'y') { if (Levitation) { floating_above(pooltype); } else if (u.usteed && !is_swimmer(u.usteed->data) @@ -1802,10 +1812,19 @@ dodip() } /* "What do you want to dip into?" */ - Strcpy(qbuf, safe_qbuf(qtoo, "What do you want to dip ", " into?", obj, - doname, thesimpleoname, shortestname) - + sizeof "What do you want to " - sizeof ""); - potion = getobj(beverages, qbuf); /* "dip into" */ + if (flags.verbose) { + /* "What do you want to " is getobj()'s prefix, "dip " is ours */ + Strcpy(qbuf, safe_qbuf(qtoo, "What do you want to dip ", " into?", + obj, doname, thesimpleoname, shortestname) + /* skip getobj()'s prefix when assigning to qbuf */ + + sizeof "What do you want to " - sizeof ""); + /* we needed the '?' in " into?" so that safe_qbuf() was working + with the right overall length, but now we need to take the '?' + off because getobj() is going to append one */ + *(eos(qbuf) - 1) = '\0'; + } else + Sprintf(qbuf, "dip %s into", shortestname); + potion = getobj(beverages, qbuf); /* qbuf[] == "dip into" */ if (!potion) return 0; if (potion == obj && potion->quan == 1L) {