candy bar wrappers

Adopt the suggestion that candy bar stacks which get split should
keep the same wrapper text for both halves of the stack.  The patch
stuck with using obj->o_id to manage the wrapper which prior to the
patch wasn't a factor in merging and splitting.  Switch to obj->spe
instead, comparable to tin varities, so mergability is already
taken care of.

End of game disclosure tacks on T-shirt text to formatted items.
Do the same for candy bar wrappers.
This commit is contained in:
PatR
2020-07-30 19:25:57 -07:00
parent 8ca0834eb2
commit c64049306d
6 changed files with 74 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 objnam.c $NHDT-Date: 1595627152 2020/07/24 21:45:52 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.303 $ */
/* NetHack 3.7 objnam.c $NHDT-Date: 1596162343 2020/07/31 02:25:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.304 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -718,10 +718,25 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
if (pluralize)
Strcpy(buf, makeplural(buf));
if (obj->otyp == T_SHIRT && g.program_state.gameover) {
/* maybe give some extra information which isn't shown during play */
if (g.program_state.gameover) {
const char *lbl;
char tmpbuf[BUFSZ];
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
/* disclose without breaking illiterate conduct, but mainly tip off
players who aren't aware that something readable is present */
switch (obj->otyp) {
case T_SHIRT:
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
break;
case CANDY_BAR:
lbl = candy_wrapper_text(obj);
if (*lbl)
Sprintf(eos(buf), " labeled \"%s\"", lbl);
break;
default:
break;
}
}
if (has_oname(obj) && dknown) {