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

Function setnotworn

src/worn.c:149–184  ·  view source on GitHub ↗

called e.g. when obj is destroyed */ Updated to use the extrinsic and blocked fields. */

Source from the content-addressed store, hash-verified

147/* called e.g. when obj is destroyed */
148/* Updated to use the extrinsic and blocked fields. */
149void
150setnotworn(struct obj *obj)
151{
152 const struct worn *wp;
153 int p;
154 long unworn = 0L;
155
156 if (!obj)
157 return;
158 if (u.twoweap && (obj == uwep || obj == uswapwep))
159 set_twoweap(FALSE); /* u.twoweap = FALSE */
160 for (wp = worn; wp->w_mask; wp++)
161 if (obj == *(wp->w_obj)) {
162 /* in case wearing or removal is in progress or removal
163 is pending (via 'A' command for multiple items) */
164 cancel_doff(obj, wp->w_mask);
165
166 *(wp->w_obj) = (struct obj *) 0;
167 unworn |= wp->w_mask;
168 p = objects[obj->otyp].oc_oprop;
169 u.uprops[p].extrinsic = u.uprops[p].extrinsic & ~wp->w_mask;
170 monstunseesu_prop(p); /* remove this extrinsic from seenres */
171 obj->owornmask &= ~wp->w_mask;
172 if (obj->oartifact)
173 set_artifact_intrinsic(obj, 0, wp->w_mask);
174 if ((p = w_blocks(obj, wp->w_mask)) != 0)
175 u.uprops[p].blocked &= ~wp->w_mask;
176 }
177 if (!uarm)
178 iflags.tux_penalty = FALSE;
179 if ((flags.weaponstatus && (unworn & W_WEP) != 0L)
180 || (flags.armorstatus && (unworn & W_ARMOR) != 0L))
181 disp.botl = TRUE;
182 update_inventory();
183 recalc_telepat_range();
184}
185
186/* called when saving with FREEING flag set has just discarded inventory */
187void

Callers 15

stealgoldFunction · 0.85
remove_worn_itemFunction · 0.85
Armor_goneFunction · 0.85
Ring_off_or_goneFunction · 0.85
litterFunction · 0.85
nhl_gamestateFunction · 0.85
mergedFunction · 0.85
useupallFunction · 0.85
fire_damageFunction · 0.85
pot_acid_damageFunction · 0.85
maybe_destroy_itemFunction · 0.85
use_mirrorFunction · 0.85

Calls 5

set_twoweapFunction · 0.85
cancel_doffFunction · 0.85
set_artifact_intrinsicFunction · 0.85
update_inventoryFunction · 0.85
recalc_telepat_rangeFunction · 0.85

Tested by

no test coverage detected