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.
This commit is contained in:
PatR
2018-06-06 17:45:44 -07:00
committed by nhmall
parent 15995375dd
commit 7951557057
3 changed files with 10 additions and 7 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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();
}
}