]> granicus.if.org Git - nethack/commitdiff
more container flags (trunk only)
authornethack.rankin <nethack.rankin>
Sun, 6 Nov 2005 06:10:32 +0000 (06:10 +0000)
committernethack.rankin <nethack.rankin>
Sun, 6 Nov 2005 06:10:32 +0000 (06:10 +0000)
     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.

src/invent.c
src/objnam.c
src/u_init.c

index 5ff39261be767e541de78f7618f1f8d6a85ff148..984d4e1df5034ddfb81f4f7d759f361f38737e6f 100644 (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);
 }
index b1c5ef1ff7733ab19b74539a4e008665c42081ed..f0e4d047b4ffdcc9b75983135a622259c5009f7e 100644 (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 */
index 0c5ea57aa6ead5abeea3567d328f5349e9567c9a..b3498f5c9aee28b2edf7651e477fe9364b8330e5 100644 (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;