From: nethack.rankin Date: Sun, 6 Nov 2005 06:10:32 +0000 (+0000) Subject: more container flags (trunk only) X-Git-Tag: MOVE2GIT~1212 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a3ac165ccaee6f6fee9b1cd948365f1e94905b0;p=nethack 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. --- diff --git a/src/invent.c b/src/invent.c index 5ff39261b..984d4e1df 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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); } diff --git a/src/objnam.c b/src/objnam.c index b1c5ef1ff..f0e4d047b 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -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 */ diff --git a/src/u_init.c b/src/u_init.c index 0c5ea57aa..b3498f5c9 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -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;