Remove an object from a monster's inventory. */
| 1374 | |
| 1375 | /* Remove an object from a monster's inventory. */ |
| 1376 | void |
| 1377 | extract_from_minvent( |
| 1378 | struct monst *mon, |
| 1379 | struct obj *obj, |
| 1380 | boolean do_extrinsics, /* whether to call update_mon_extrinsics */ |
| 1381 | boolean silently) /* doesn't affect all possible messages, |
| 1382 | * just update_mon_extrinsics's */ |
| 1383 | { |
| 1384 | long unwornmask = obj->owornmask; |
| 1385 | |
| 1386 | /* |
| 1387 | * At its core this is just obj_extract_self(), but it also handles |
| 1388 | * any updates that need to happen if the gear is equipped or in |
| 1389 | * some other sort of state that needs handling. |
| 1390 | * Note that like obj_extract_self(), this leaves obj free. |
| 1391 | */ |
| 1392 | |
| 1393 | if (obj->where != OBJ_MINVENT) { |
| 1394 | impossible("extract_from_minvent called on object not in minvent"); |
| 1395 | return; |
| 1396 | } |
| 1397 | /* handle gold dragon scales/scale-mail (lit when worn) before clearing |
| 1398 | obj->owornmask because artifact_light() expects that to be W_ARM */ |
| 1399 | if ((unwornmask & W_ARM) != 0 && obj->lamplit && artifact_light(obj)) |
| 1400 | end_burn(obj, FALSE); |
| 1401 | |
| 1402 | obj_extract_self(obj); |
| 1403 | obj->owornmask = 0L; |
| 1404 | if (unwornmask) { |
| 1405 | if (!DEADMONSTER(mon) && do_extrinsics) { |
| 1406 | update_mon_extrinsics(mon, obj, FALSE, silently); |
| 1407 | } |
| 1408 | mon->misc_worn_check &= ~unwornmask; |
| 1409 | /* give monster a chance to wear other equipment on its next |
| 1410 | move instead of waiting until it picks something up */ |
| 1411 | check_gear_next_turn(mon); |
| 1412 | } |
| 1413 | obj_no_longer_held(obj); |
| 1414 | if (unwornmask & W_WEP) { |
| 1415 | mwepgone(mon); /* unwields and sets weapon_check to NEED_WEAPON */ |
| 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | #undef w_blocks |
| 1420 |
no test coverage detected