From 79515570572912dff759eb45da96b76670ad894e Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 6 Jun 2018 17:45:44 -0700 Subject: [PATCH] makeknown() Noticed while investigating the report about sortloot interacting with persistent inventory window when identifying all of invent and possibly skipping some items. [This doesn't fix that.] End of game disclosure was using makeknown() on inventory. It is a jacket around discover_object() which passes the flag to exercise Wisdom. That's useless at end of game [now; conceivably wrong if disclosure of characteristics exercise ever got added], so call discover_object() directly to suppress exercise of Wisdom. discover_object() was also calling update_inventory() for every item being discovered. That's not useful when looping through inventory at end of game. --- doc/fixes36.2 | 2 ++ src/end.c | 10 +++++----- src/o_init.c | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index 802ce2507..935394f98 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -30,6 +30,8 @@ using 'O' to set up a hilite_status rule for string comparison, the menu for when finishing using 'O' to examine or set hilite_status rules, if the 'statushilites' option is 0 and there is at least one rule, give a reminder about setting it to non-zero to activate highlighting +end of game disclosure was exercising Wisdom when revealing inventory and + also repeatedly updating persistent inventory window if enabled Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/end.c b/src/end.c index d0b51df53..ebb45187c 100644 --- a/src/end.c +++ b/src/end.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 end.c $NHDT-Date: 1512803167 2017/12/09 07:06:07 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.137 $ */ +/* NetHack 3.6 end.c $NHDT-Date: 1528332335 2018/06/07 00:45:35 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.141 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -985,7 +985,7 @@ winid endwin; if (counting) { nowrap_add(u.urexp, points); } else { - makeknown(otmp->otyp); + discover_object(otmp->otyp, TRUE, FALSE); otmp->known = otmp->dknown = otmp->bknown = otmp->rknown = 1; /* assumes artifacts don't have quan > 1 */ Sprintf(pbuf, "%s%s (worth %ld %s and %ld points)", @@ -1178,7 +1178,7 @@ int how; * it in both of those places. */ for (obj = invent; obj; obj = obj->nobj) { - makeknown(obj->otyp); + discover_object(obj->otyp, TRUE, FALSE); obj->known = obj->bknown = obj->dknown = obj->rknown = 1; if (Is_container(obj) || obj->otyp == STATUE) obj->cknown = obj->lknown = 1; @@ -1400,7 +1400,7 @@ int how; continue; if (objects[typ].oc_class != GEM_CLASS || typ <= LAST_GEM) { otmp = mksobj(typ, FALSE, FALSE); - makeknown(otmp->otyp); + discover_object(otmp->otyp, TRUE, FALSE); otmp->known = 1; /* for fake amulets */ otmp->dknown = 1; /* seen it (blindness fix) */ if (has_oname(otmp)) @@ -1509,7 +1509,7 @@ boolean identified, all_containers, reportempty; putstr(tmpwin, 0, ""); for (obj = box->cobj; obj; obj = obj->nobj) { if (identified) { - makeknown(obj->otyp); + discover_object(obj->otyp, TRUE, FALSE); obj->known = obj->bknown = obj->dknown = obj->rknown = 1; if (Is_container(obj) || obj->otyp == STATUE) diff --git a/src/o_init.c b/src/o_init.c index 3edadd811..b4fc440ee 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 o_init.c $NHDT-Date: 1450318588 2015/12/17 02:16:28 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $ */ +/* NetHack 3.6 o_init.c $NHDT-Date: 1528332336 2018/06/07 00:45:36 $ $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.24 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -361,7 +361,8 @@ boolean credit_hero; if (credit_hero) exercise(A_WIS, TRUE); } - if (moves > 1L) + /* moves==1L => initial inventory, gameover => final disclosure */ + if (moves > 1L && !program_state.gameover) update_inventory(); } } -- 2.40.0