| 711 | } |
| 712 | |
| 713 | staticfn int |
| 714 | drop(struct obj *obj) |
| 715 | { |
| 716 | if (!obj) |
| 717 | return ECMD_FAIL; |
| 718 | if (!canletgo(obj, "drop")) |
| 719 | return ECMD_FAIL; |
| 720 | if (obj->otyp == CORPSE && better_not_try_to_drop_that(obj)) |
| 721 | return ECMD_FAIL; |
| 722 | if (obj == uwep) { |
| 723 | if (welded(uwep)) { |
| 724 | weldmsg(obj); |
| 725 | return ECMD_FAIL; |
| 726 | } |
| 727 | setuwep((struct obj *) 0); |
| 728 | } |
| 729 | if (obj == uquiver) { |
| 730 | setuqwep((struct obj *) 0); |
| 731 | } |
| 732 | if (obj == uswapwep) { |
| 733 | setuswapwep((struct obj *) 0); |
| 734 | } |
| 735 | |
| 736 | if (u.uswallow) { |
| 737 | /* barrier between you and the floor */ |
| 738 | if (flags.verbose) { |
| 739 | char *onam_p, *mnam_p, monbuf[BUFSZ]; |
| 740 | |
| 741 | mnam_p = mon_nam(u.ustuck); |
| 742 | /* doname can call s_suffix, reusing its buffer */ |
| 743 | if (digests(u.ustuck->data)) { |
| 744 | Sprintf(monbuf, "%s %s", s_suffix(mnam_p), |
| 745 | mbodypart(u.ustuck, STOMACH)); |
| 746 | mnam_p = monbuf; |
| 747 | } |
| 748 | onam_p = is_unpaid(obj) ? yobjnam(obj, (char *) 0) : doname(obj); |
| 749 | |
| 750 | You("drop %s into %s.", onam_p, mnam_p); |
| 751 | } |
| 752 | } else { |
| 753 | if ((obj->oclass == RING_CLASS || obj->otyp == MEAT_RING) |
| 754 | && IS_SINK(levl[u.ux][u.uy].typ)) { |
| 755 | dosinkring(obj); |
| 756 | return ECMD_TIME; |
| 757 | } |
| 758 | if (!can_reach_floor(TRUE)) { |
| 759 | /* we might be levitating due to #invoke Heart of Ahriman; |
| 760 | if so, levitation would end during call to freeinv() |
| 761 | and we want hitfloor() to happen before float_down() */ |
| 762 | boolean levhack = finesse_ahriman(obj); |
| 763 | |
| 764 | if (levhack) |
| 765 | ELevitation = W_ART; /* other than W_ARTI */ |
| 766 | if (flags.verbose) |
| 767 | You("drop %s.", doname(obj)); |
| 768 | freeinv(obj); |
| 769 | hitfloor(obj, TRUE); |
| 770 | if (levhack) |
no test coverage detected