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

Function shrinking_glob_gone

src/mkobj.c:1672–1701  ·  view source on GitHub ↗

a glob has shrunk away to nothing; handle owornmask, then delete glob */

Source from the content-addressed store, hash-verified

1670
1671/* a glob has shrunk away to nothing; handle owornmask, then delete glob */
1672staticfn void
1673shrinking_glob_gone(struct obj *obj)
1674{
1675 xint16 owhere = obj->where;
1676
1677 if (owhere == OBJ_INVENT) {
1678 if (obj->owornmask) {
1679 remove_worn_item(obj, FALSE);
1680 stop_occupation();
1681 }
1682 useupall(obj); /* freeinv()+obfree() */
1683 } else {
1684 if (owhere == OBJ_MIGRATING) {
1685 /* destination flag overloads owornmask; clear it so obfree()'s
1686 check for freeing a worn object doesn't get a false hit */
1687 obj->owornmask = 0L;
1688 } else if (owhere == OBJ_MINVENT) {
1689 /* monsters don't wield globs so this isn't strictly needed */
1690 if (obj->owornmask && obj == MON_WEP(obj->ocarry))
1691 setmnotwielded(obj->ocarry, obj); /* clears owornmask */
1692 }
1693 /* remove the glob from whatever list it's on and then delete it;
1694 if it's contained, obj_extract_self() will update the container's
1695 weight and if nested, the enclosing containers' weights too */
1696 obj_extract_self(obj);
1697 if (owhere == OBJ_FLOOR)
1698 maybe_unhide_at(obj->ox, obj->oy);
1699 obfree(obj, (struct obj *) 0);
1700 }
1701}
1702
1703void
1704maybe_adjust_light(struct obj *obj, int old_range)

Callers 1

shrink_globFunction · 0.85

Calls 7

remove_worn_itemFunction · 0.85
stop_occupationFunction · 0.85
useupallFunction · 0.85
setmnotwieldedFunction · 0.85
obj_extract_selfFunction · 0.85
maybe_unhide_atFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected