more container flags (trunk only)

cknown and lknown flags for containers are now checked when deciding
whether an item is fully identified, and they're set when identification
takes place.  (You'll learn how many items are inside even if you haven't
looked to see what they are yet.  This means that an inventory listing of
unpaid items will reveal the contents after you've used enouch magic to ID
an unpaid container.)  Also, set those flags for any container in initial
inventory; rogues should know that sack starts out empty.
This commit is contained in:
nethack.rankin
2005-11-06 06:10:32 +00:00
parent b9ae4361af
commit 0a3ac165cc
3 changed files with 12 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)invent.c 3.5 2005/06/02 */
/* SCCS Id: @(#)invent.c 3.5 2005/11/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1472,6 +1472,8 @@ struct obj *otmp;
makeknown(otmp->otyp);
if (otmp->oartifact) discover_artifact((xchar)otmp->oartifact);
otmp->known = otmp->dknown = otmp->bknown = otmp->rknown = 1;
if (Is_container(otmp) || otmp->otyp == STATUE)
otmp->cknown = otmp->lknown = 1;
if (otmp->otyp == EGG && otmp->corpsenm != NON_PM)
learn_egg_type(otmp->corpsenm);
}

View File

@@ -822,6 +822,9 @@ register struct obj *otmp;
#endif
!objects[otmp->otyp].oc_name_known) /* ?redundant? */
return TRUE;
if ((!otmp->cknown && (Is_container(otmp) || otmp->otyp == STATUE)) ||
(!otmp->lknown && Is_box(otmp)))
return TRUE;
if (otmp->oartifact && undiscovered_artifact(otmp->oartifact))
return TRUE;
/* otmp->rknown is the only item of interest if we reach here */

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)u_init.c 3.5 2005/09/19 */
/* SCCS Id: @(#)u_init.c 3.5 2005/11/05 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -980,8 +980,12 @@ register struct trobj *trop;
obj->quan = u.umoney0;
} else {
#endif
obj->dknown = obj->bknown = obj->rknown = 1;
if (objects[otyp].oc_uses_known) obj->known = 1;
obj->dknown = obj->bknown = obj->rknown = 1;
if (Is_container(obj) || obj->otyp == STATUE) {
obj->cknown = obj->lknown = 1;
obj->otrapped = 0;
}
obj->cursed = 0;
if (obj->opoisoned && u.ualign.type != A_CHAOTIC)
obj->opoisoned = 0;