Unify probing an object chain

This commit is contained in:
Pasi Kallinen
2022-04-25 18:11:32 +03:00
parent 9334086506
commit 9c2ca1577f

View File

@@ -12,6 +12,7 @@
*/
#define MAGIC_COOKIE 1000
static void probe_objchain(struct obj *);
static boolean zombie_can_dig(xchar x, xchar y);
static void polyuse(struct obj *, int, int);
static void create_polymon(struct obj *, int);
@@ -508,24 +509,28 @@ release_hold(void)
}
}
static void
probe_objchain(struct obj *otmp)
{
for (; otmp; otmp = otmp->nobj) {
otmp->dknown = 1; /* treat as "seen" */
if (Is_container(otmp) || otmp->otyp == STATUE) {
otmp->lknown = 1;
if (!SchroedingersBox(otmp))
otmp->cknown = 1;
}
}
}
void
probe_monster(struct monst *mtmp)
{
struct obj *otmp;
mstatusline(mtmp);
if (g.notonhead)
return; /* don't show minvent for long worm tail */
if (mtmp->minvent) {
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj) {
otmp->dknown = 1; /* treat as "seen" */
if (Is_container(otmp) || otmp->otyp == STATUE) {
otmp->lknown = 1;
if (!SchroedingersBox(otmp))
otmp->cknown = 1;
}
}
probe_objchain(mtmp->minvent);
(void) display_minventory(mtmp, MINV_ALL | MINV_NOLET | PICK_NONE,
(char *) 0);
} else {
@@ -2701,22 +2706,12 @@ zapyourself(struct obj *obj, boolean ordinary)
case SPE_DETECT_UNSEEN:
case WAN_NOTHING:
break;
case WAN_PROBING: {
struct obj *otmp;
for (otmp = g.invent; otmp; otmp = otmp->nobj) {
otmp->dknown = 1;
if (Is_container(otmp) || otmp->otyp == STATUE) {
otmp->lknown = 1;
if (!SchroedingersBox(otmp))
otmp->cknown = 1;
}
}
case WAN_PROBING:
probe_objchain(g.invent);
update_inventory();
learn_it = TRUE;
ustatusline();
break;
}
case SPE_STONE_TO_FLESH: {
struct obj *otmp, *onxt;
boolean didmerge;