some common tests when trying to drop or throw items */
| 662 | |
| 663 | /* some common tests when trying to drop or throw items */ |
| 664 | boolean |
| 665 | canletgo(struct obj *obj, const char *word) |
| 666 | { |
| 667 | if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) { |
| 668 | if (*word) |
| 669 | Norep("You cannot %s %s you are wearing.", word, something); |
| 670 | return FALSE; |
| 671 | } |
| 672 | if (obj == uwep && welded(uwep)) { |
| 673 | /* no weldmsg(), so uwep->bknown might become set silently |
| 674 | if word is "" */ |
| 675 | if (*word) { |
| 676 | const char *hand = body_part(HAND); |
| 677 | |
| 678 | if (bimanual(uwep)) |
| 679 | hand = makeplural(hand); |
| 680 | Norep("You cannot %s %s welded to your %s.", word, something, |
| 681 | hand); |
| 682 | } |
| 683 | return FALSE; |
| 684 | } |
| 685 | if (obj->otyp == LOADSTONE && obj->cursed) { |
| 686 | /* getobj() kludge sets corpsenm to user's specified count |
| 687 | when refusing to split a stack of cursed loadstones */ |
| 688 | if (*word) { |
| 689 | /* getobj() ignores a count for throwing since that is |
| 690 | implicitly forced to be 1; replicate its kludge... */ |
| 691 | if (!strcmp(word, "throw") && obj->quan > 1L) |
| 692 | obj->corpsenm = 1; |
| 693 | pline("For some reason, you cannot %s%s the stone%s!", word, |
| 694 | obj->corpsenm ? " any of" : "", plur(obj->quan)); |
| 695 | } |
| 696 | obj->corpsenm = 0; /* reset */ |
| 697 | set_bknown(obj, 1); |
| 698 | return FALSE; |
| 699 | } |
| 700 | if (obj->otyp == LEASH && obj->leashmon != 0) { |
| 701 | if (*word) |
| 702 | pline_The("leash is tied around your %s.", body_part(HAND)); |
| 703 | return FALSE; |
| 704 | } |
| 705 | if (obj->owornmask & W_SADDLE) { |
| 706 | if (*word) |
| 707 | You("cannot %s %s you are sitting on.", word, something); |
| 708 | return FALSE; |
| 709 | } |
| 710 | return TRUE; |
| 711 | } |
| 712 | |
| 713 | staticfn int |
| 714 | drop(struct obj *obj) |
no test coverage detected