MCPcopy Create free account
hub / github.com/NetHack/NetHack / cancel_doff

Function cancel_doff

src/do_wear.c:1644–1659  ·  view source on GitHub ↗

despite their names, cancel_don() and cancel_doff() both apply to both donning and doffing... */

Source from the content-addressed store, hash-verified

1642/* despite their names, cancel_don() and cancel_doff() both apply to both
1643 donning and doffing... */
1644void
1645cancel_doff(struct obj *obj, long slotmask)
1646{
1647 /* Called by setworn() for old item in specified slot or by setnotworn()
1648 * for specified item. We don't want to call cancel_don() if we got
1649 * here via <X>_off() -> setworn((struct obj *) 0) -> cancel_doff()
1650 * because that would stop the 'A' command from continuing with next
1651 * selected item. So do_takeoff() sets a flag in takeoff.mask for us.
1652 * [For taking off an individual item with 'T'/'R'/'w-', it doesn't
1653 * matter whether cancel_don() gets called here--the item has already
1654 * been removed by now.]
1655 */
1656 if (!(svc.context.takeoff.mask & I_SPECIAL) && donning(obj))
1657 cancel_don(); /* applies to doffing too */
1658 svc.context.takeoff.mask &= ~slotmask;
1659}
1660
1661/* despite their names, cancel_don() and cancel_doff() both apply to both
1662 donning and doffing... */

Callers 2

setwornFunction · 0.85
setnotwornFunction · 0.85

Calls 2

donningFunction · 0.85
cancel_donFunction · 0.85

Tested by

no test coverage detected