probing vs Schroedinger's Cat (trunk only)

Someone in the newsgroup complained about zapping probing at a large
box dropped by a quantum mechanic and being told that it was empty rather
than that it held a corpse or live cat.  This sidesteps the issue by
reporting "the box seems empty" instead of "the box is empty", and not
setting its contents-known flag.  (That message is the main difference
between probing and the assorted other methods of observation [telepathy
and monster detection and possibly Warning for live cat, object detection
and food detection for dead cat's corpse] which might be expected to
trigger the cat's fate but don't.)  This also makes probing of self and
of monsters set the contents-known and locking-known flags for containers
in inventory, same as is done for probing which hits objects.  (Display of
container contents still only occurs for loose objects, not in inventory.)
This commit is contained in:
nethack.rankin
2007-02-18 02:20:59 +00:00
parent 0ceebfc4b5
commit 7abf238f1b
5 changed files with 33 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)obj.h 3.5 2006/12/14 */
/* SCCS Id: @(#)obj.h 3.5 2007/02/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -242,6 +242,7 @@ struct obj {
#define Is_box(otmp) (otmp->otyp == LARGE_BOX || otmp->otyp == CHEST)
#define Is_mbag(otmp) (otmp->otyp == BAG_OF_HOLDING || \
otmp->otyp == BAG_OF_TRICKS)
#define SchroedingersBox(o) ((o)->otyp == LARGE_BOX && (o)->spe == 1)
/* dragon gear */
#define Is_dragon_scales(obj) ((obj)->otyp >= GRAY_DRAGON_SCALES && \

View File

@@ -515,7 +515,7 @@ int what;
switch(what) {
case CAT_CHECK: /* Schroedinger's Cat */
/* Ascending is deterministic */
if (otmp->otyp == LARGE_BOX && otmp->spe == 1)
if (SchroedingersBox(otmp))
return rn2(2);
break;
}
@@ -972,8 +972,7 @@ boolean identified, all_containers, reportempty;
box->cknown = 1; /* we're looking at the contents now */
if (identified) box->lknown = 1;
cat = deadcat = FALSE;
if (box->otyp == LARGE_BOX &&
box->spe == 1 && !Schroedingers_cat) {
if (SchroedingersBox(box) && !Schroedingers_cat) {
/* Schroedinger's Cat? */
cat = odds_and_ends(box, CAT_CHECK);
if (cat) Schroedingers_cat = TRUE;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mkobj.c 3.5 2007/01/02 */
/* SCCS Id: @(#)mkobj.c 3.5 2007/02/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1082,7 +1082,7 @@ register struct obj *obj;
{
int wt = objects[obj->otyp].oc_weight;
if (obj->otyp == LARGE_BOX && obj->spe == 1) /* Schroedinger's Cat */
if (SchroedingersBox(obj))
wt += mons[PM_HOUSECAT].cwt;
if (Is_container(obj) || obj->otyp == STATUE) {
struct obj *contents;

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)pickup.c 3.5 2007/01/02 */
/* SCCS Id: @(#)pickup.c 3.5 2007/02/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2166,7 +2166,7 @@ int held;
/* from here on out, all early returns go through containerdone */
/* check for Schroedinger's Cat */
quantum_cat = (current_container->spe == 1); /* "it's _now_ empty" */
quantum_cat = SchroedingersBox(current_container);
if (quantum_cat) {
observe_quantum_cat(current_container);
used = 1;
@@ -2706,7 +2706,7 @@ struct obj *box; /* or bag */
}
if (maybeshopgoods && !box->no_charge)
subfrombill(box, shop_keeper(*in_rooms(ox, oy, SHOPBASE)));
} else if (box->spe) {
} else if (SchroedingersBox(box)) {
char yourbuf[BUFSZ];
observe_quantum_cat(box);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)zap.c 3.5 2007/01/27 */
/* SCCS Id: @(#)zap.c 3.5 2007/02/17 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -434,9 +434,14 @@ struct monst *mtmp;
#else
if (mtmp->minvent) {
#endif
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
otmp->dknown = 1; /* treat as "seen" */
(void) display_minventory(mtmp, MINV_ALL, (char *)0);
if (Is_container(otmp) || otmp->otyp == STATUE) {
otmp->lknown = 1;
if (!SchroedingersBox(otmp)) otmp->cknown = 1;
}
}
(void) display_minventory(mtmp, MINV_ALL|MINV_NOLET, (char *)0);
} else {
pline("%s is not carrying anything.", noit_Monnam(mtmp));
}
@@ -1614,9 +1619,16 @@ struct obj *obj, *otmp;
obj->dknown = 1;
if (Is_container(obj) || obj->otyp == STATUE) {
obj->cknown = obj->lknown = 1;
if (!obj->cobj)
pline("%s empty.", Tobjnam(obj, "are"));
else {
if (!obj->cobj) {
boolean catbox = SchroedingersBox(obj);
/* we don't want to force alive vs dead
determination for Schroedinger's Cat here,
so just make probing be inconclusive for it */
if (catbox) obj->cknown = 0;
pline("%s empty.",
Tobjnam(obj, catbox ? "seem" : "are"));
} else {
struct obj *o;
/* view contents (not recursively) */
for (o = obj->cobj; o; o = o->nobj)
@@ -2243,8 +2255,13 @@ boolean ordinary;
{
struct obj *otmp;
for (otmp = invent; otmp; otmp = otmp->nobj)
for (otmp = invent; otmp; otmp = otmp->nobj) {
otmp->dknown = 1;
if (Is_container(otmp) || otmp->otyp == STATUE) {
otmp->lknown = 1;
if (!SchroedingersBox(otmp)) otmp->cknown = 1;
}
}
learn_it = TRUE;
ustatusline();
break;