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

Function doffing

src/do_wear.c:1602–1640  ·  view source on GitHub ↗

check whether the target object is currently being taken off, so that stop_donning() and steal() can vary messages and doname() can vary "(being worn)" suffix */

Source from the content-addressed store, hash-verified

1600 so that stop_donning() and steal() can vary messages and doname()
1601 can vary "(being worn)" suffix */
1602boolean
1603doffing(struct obj *otmp)
1604{
1605 long what = svc.context.takeoff.what;
1606 boolean result = FALSE;
1607
1608 /* 'T' (or 'R' used for armor) sets ga.afternmv, 'A' sets takeoff.what */
1609 if (otmp == uarm)
1610 result = (ga.afternmv == Armor_off || what == WORN_ARMOR);
1611 else if (otmp == uarmu)
1612 result = (ga.afternmv == Shirt_off || what == WORN_SHIRT);
1613 else if (otmp == uarmc)
1614 result = (ga.afternmv == Cloak_off || what == WORN_CLOAK);
1615 else if (otmp == uarmf)
1616 result = (ga.afternmv == Boots_off || what == WORN_BOOTS);
1617 else if (otmp == uarmh)
1618 result = (ga.afternmv == Helmet_off || what == WORN_HELMET);
1619 else if (otmp == uarmg)
1620 result = (ga.afternmv == Gloves_off || what == WORN_GLOVES);
1621 else if (otmp == uarms)
1622 result = (ga.afternmv == Shield_off || what == WORN_SHIELD);
1623 /* these 1-turn items don't need 'ga.afternmv' checks */
1624 else if (otmp == uamul)
1625 result = (what == WORN_AMUL);
1626 else if (otmp == uleft)
1627 result = (what == LEFT_RING);
1628 else if (otmp == uright)
1629 result = (what == RIGHT_RING);
1630 else if (otmp == ublindf)
1631 result = (what == WORN_BLINDF);
1632 else if (otmp == uwep)
1633 result = (what == W_WEP);
1634 else if (otmp == uswapwep)
1635 result = (what == W_SWAPWEP);
1636 else if (otmp == uquiver)
1637 result = (what == W_QUIVER);
1638
1639 return result;
1640}
1641
1642/* despite their names, cancel_don() and cancel_doff() both apply to both
1643 donning and doffing... */

Callers 4

stealFunction · 0.85
donningFunction · 0.85
stop_donningFunction · 0.85
doname_baseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected