From c6992777f580acafc2e7c2f219da1612607842a6 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 27 Mar 2024 23:52:37 -0700 Subject: [PATCH] end-of-game attribute disclosure in wizard mode Disclosing final inventory while wearing an alchemy smock reported the apron's slogan accurately but then disclosing attributes gave different text if it was conferring poison resistance and/or acid resistance. The extra text was unneeded/unwanted there anyway, so simply suppress it rather than force it to be accurate. 3.6.x had the same issue but it wasn't detectable there because it only had extra text for T-shirts and they don't confer attributes. --- doc/fixes3-7-0.txt | 4 ++++ src/objnam.c | 17 +++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 3c03571b1..baf99f84a 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1907,6 +1907,10 @@ if hero was wielding potion(s) of unholy water and a magic trap gave its remove curse effect, scroll of remove curse would become discovered object discoveries during the tutorial carried over when normal play resumed; counts of monsters created and vanquished carried over too +end-of-game attribute disclosure in wizard mode reported incorrect text for + for apron/alchemy smock's conferral of poison+acid resistances + (3.6.x was susceptible to this for T-shirt text but since T-shirts + don't confer any attributes, it wasn't noticeable) Fixes to 3.7.0-x Platform and/or Interface Problems Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index b2422de54..747c261dc 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -928,8 +928,17 @@ xname_flags( releaseobuf(obufp); } - /* maybe give some extra information which isn't shown during play */ - if (gp.program_state.gameover && bufspaceleft > 0) { + /* give some extra information when game is over; for end-of-game + attribute disclosure in wizard mode, ysimple_name() calls + minimal_xname() which passes us a dummy object with o_id==0; + tshirt_text(), apron_text(), and so forth base their result on + o_id and would give inconsistent information compared to what + just got shown for inventory disclosure; fortunately, we want to + avoid the 'with text' part of + "You were acid resistant because of your alchemy smock \ + with text \"Kiss the cook\"." + when disclosing attributes anyway */ + if (gp.program_state.gameover && obj->o_id && bufspaceleft > 0) { const char *lbl; char tmpbuf[BUFSZ]; @@ -1033,9 +1042,9 @@ minimal_xname(struct obj *obj) if (obj->otyp == SLIME_MOLD) bareobj.spe = obj->spe; - /* bufp will be an obuf[] and a pointer into middle of that is viable */ bufp = distant_name(&bareobj, xname); - /* undo forced setting of bareobj.blessed for cleric (preist[ess]) */ + /* undo forced setting of bareobj.blessed for cleric (preist[ess]); + bufp is an obuf[] so a pointer into the middle of that is viable */ if (!strncmp(bufp, "uncursed ", 9)) bufp += 9;