drop one object taken from a (possibly dead) monster's inventory */
| 811 | |
| 812 | /* drop one object taken from a (possibly dead) monster's inventory */ |
| 813 | void |
| 814 | mdrop_obj( |
| 815 | struct monst *mon, |
| 816 | struct obj *obj, |
| 817 | boolean verbosely) |
| 818 | { |
| 819 | coordxy omx = mon->mx, omy = mon->my; |
| 820 | long unwornmask = obj->owornmask; |
| 821 | /* call distant_name() for its possible side-effects even if the result |
| 822 | might not be printed, and do it before extracting obj from minvent */ |
| 823 | char *obj_name = distant_name(obj, doname); |
| 824 | |
| 825 | extract_from_minvent(mon, obj, FALSE, TRUE); |
| 826 | /* don't charge for an owned saddle on dead steed (provided |
| 827 | that the hero is within the same shop at the time) */ |
| 828 | if (unwornmask && mon->mtame && (unwornmask & W_SADDLE) != 0L |
| 829 | && !obj->unpaid && costly_spot(omx, omy) |
| 830 | /* being at costly_spot guarantees lev->roomno is not 0 */ |
| 831 | && strchr(in_rooms(u.ux, u.uy, SHOPBASE), levl[omx][omy].roomno)) { |
| 832 | obj->no_charge = 1; |
| 833 | } |
| 834 | /* obj_no_longer_held(obj); -- done by place_object */ |
| 835 | if (verbosely && cansee(omx, omy)) |
| 836 | pline_mon(mon, "%s drops %s.", Monnam(mon), obj_name); |
| 837 | if (!flooreffects(obj, omx, omy, "fall")) { |
| 838 | place_object(obj, omx, omy); |
| 839 | stackobj(obj); |
| 840 | } |
| 841 | /* do this last, after placing obj on floor; removing steed's saddle |
| 842 | throws rider, possibly inflicting fatal damage and producing bones; this |
| 843 | is why we had to call extract_from_minvent() with do_intrinsics=FALSE */ |
| 844 | if (!DEADMONSTER(mon) && unwornmask) |
| 845 | update_mon_extrinsics(mon, obj, FALSE, TRUE); |
| 846 | } |
| 847 | |
| 848 | /* some monsters bypass the normal rules for moving between levels or |
| 849 | even leaving the game entirely; when that happens, prevent them from |
no test coverage detected