-/* NetHack 3.7 display.c $NHDT-Date: 1652391730 2022/05/12 21:42:10 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ */
+/* NetHack 3.7 display.c $NHDT-Date: 1654931503 2022/06/11 07:11:43 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.184 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
* something has been dropped on the ball/chain. If the bit is
* not cleared, then when the ball/chain is moved it will drop
* the wrong glyph.
+ *
+ * Note: during unpunish() we can be called by delobj() when
+ * destroying uchain while uball hasn't been cleared yet (so
+ * Punished will still yield True but uchain might not be part
+ * of the floor list anymore).
*/
- if (uchain->ox == x && uchain->oy == y) {
- if (g.level.objects[x][y] == uchain)
- u.bc_felt |= BC_CHAIN;
- else
- u.bc_felt &= ~BC_CHAIN; /* do not feel the chain */
- }
- if (!carried(uball) && uball->ox == x && uball->oy == y) {
- if (g.level.objects[x][y] == uball)
- u.bc_felt |= BC_BALL;
- else
- u.bc_felt &= ~BC_BALL; /* do not feel the ball */
- }
+ if (uchain && uchain->where == OBJ_FLOOR
+ && uchain->ox == x && uchain->oy == y
+ && g.level.objects[x][y] == uchain)
+ u.bc_felt |= BC_CHAIN;
+ else
+ u.bc_felt &= ~BC_CHAIN; /* do not feel the chain */
+
+ if (uball && uball->where == OBJ_FLOOR
+ && uball->ox == x && uball->oy == y
+ && g.level.objects[x][y] == uball)
+ u.bc_felt |= BC_BALL;
+ else
+ u.bc_felt &= ~BC_BALL; /* do not feel the ball */
}
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
-/* NetHack 3.7 read.c $NHDT-Date: 1637992351 2021/11/27 05:52:31 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.229 $ */
+/* NetHack 3.7 read.c $NHDT-Date: 1654931501 2022/06/11 07:11:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.257 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
struct obj *savechain = uchain;
/* chain goes away */
- obj_extract_self(uchain);
- maybe_unhide_at(uchain->ox, uchain->oy);
- newsym(uchain->ox, uchain->oy);
setworn((struct obj *) 0, W_CHAIN); /* sets 'uchain' to Null */
- dealloc_obj(savechain);
+ /* for floor, unhides monster hidden under chain, calls newsym() */
+ delobj(savechain);
+
/* the chain is gone but the no longer attached ball persists */
setworn((struct obj *) 0, W_BALL); /* sets 'uball' to Null */
}