| 2692 | } |
| 2693 | |
| 2694 | staticfn |
| 2695 | int |
| 2696 | select_off(struct obj *otmp) |
| 2697 | { |
| 2698 | struct obj *why; |
| 2699 | char buf[BUFSZ]; |
| 2700 | |
| 2701 | if (!otmp) |
| 2702 | return 0; |
| 2703 | *buf = '\0'; /* lint suppression */ |
| 2704 | |
| 2705 | /* special ring checks */ |
| 2706 | if (otmp == uright || otmp == uleft) { |
| 2707 | struct obj glibdummy; |
| 2708 | |
| 2709 | if (nolimbs(gy.youmonst.data)) { |
| 2710 | pline_The("ring is stuck."); |
| 2711 | return 0; |
| 2712 | } |
| 2713 | glibdummy = cg.zeroobj; |
| 2714 | why = 0; /* the item which prevents ring removal */ |
| 2715 | if (welded(uwep) && ((otmp == RING_ON_PRIMARY) || bimanual(uwep))) { |
| 2716 | Sprintf(buf, "free a weapon %s", body_part(HAND)); |
| 2717 | why = uwep; |
| 2718 | } else if (uarmg && (uarmg->cursed || Glib)) { |
| 2719 | Sprintf(buf, "take off your %s%s", |
| 2720 | Glib ? "slippery " : "", gloves_simple_name(uarmg)); |
| 2721 | why = !Glib ? uarmg : &glibdummy; |
| 2722 | } |
| 2723 | if (why) { |
| 2724 | You("cannot %s to remove the ring.", buf); |
| 2725 | set_bknown(why, 1); |
| 2726 | return 0; |
| 2727 | } |
| 2728 | } |
| 2729 | /* special glove checks */ |
| 2730 | if (otmp == uarmg) { |
| 2731 | if (welded(uwep)) { |
| 2732 | You("are unable to take off your %s while wielding that %s.", |
| 2733 | c_gloves, is_sword(uwep) ? c_sword : c_weapon); |
| 2734 | set_bknown(uwep, 1); |
| 2735 | return 0; |
| 2736 | } else if (Glib) { |
| 2737 | pline("%s %s are too slippery to take off.", |
| 2738 | uarmg->unpaid ? "The" : "Your", /* simplified Shk_Your() */ |
| 2739 | gloves_simple_name(uarmg)); |
| 2740 | return 0; |
| 2741 | } |
| 2742 | if (better_not_take_that_off(otmp)) |
| 2743 | return 0; |
| 2744 | } |
| 2745 | /* special boot checks */ |
| 2746 | if (otmp == uarmf) { |
| 2747 | if (u.utrap && u.utraptype == TT_BEARTRAP) { |
| 2748 | pline_The("bear trap prevents you from pulling your %s out.", |
| 2749 | body_part(FOOT)); |
| 2750 | return 0; |
| 2751 | } else if (u.utrap && u.utraptype == TT_INFLOOR) { |
no test coverage detected