From: PatR Date: Wed, 17 Feb 2016 00:06:02 +0000 (-0800) Subject: fix for 'R' on armor ignoring 'T's restrictions X-Git-Tag: NetHack-3.6.1_RC01~920 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5a39c0596137356b6631b723b9e19e41d0b64f3;p=nethack fix for 'R' on armor ignoring 'T's restrictions Reported directly to devteam, the 'R' command would let you take off a suit from under a cloak or a shirt from under a suit and/or a cloak, and it didn't require any extra turns. 'T' doesn't allow either of those. ('A' lets you take off a suit from under a cloak, adding in extra turns to implicitly take the cloak off and put it back on, but doesn't allow the same for shirt.) 'R' also let you attempt to take off embedded dragon scales if you were wearing 2 or more accessories (or just 1 with paranoid_confirm set for takeoff/remove), which triggered impossible "select_off: (embedded in skin)???". --- diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 6509afc63..3ea3df8fd 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -157,6 +157,9 @@ issues with Warning when you're adjacent to an undetected hider; clearly you are aware a monster is present so this causes you to search it out allow lookup of names like Hachi when selecting monsters from the map lookup "More Info?" prompt will now tell you what it will look for on 'y' +using 'R' on armor would bypass some restrictions imposed by 'T' (inner layer + could be taken off from under outer layer, embedded scales could be + attempted but triggered "select_off" impossible) Platform- and/or Interface-Specific Fixes diff --git a/src/do_wear.c b/src/do_wear.c index bedda5298..1f84aa6d8 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1446975698 2015/11/08 09:41:38 $ $NHDT-Branch: master $:$NHDT-Revision: 1.87 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1455667557 2016/02/17 00:05:57 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.90 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1380,6 +1380,27 @@ struct obj *obj; You("are not wearing that."); return 0; } + if (obj == uskin + || ((obj == uarm) && uarmc) + || ((obj == uarmu) && (uarmc || uarm))) { + char why[QBUFSZ], what[QBUFSZ]; + + why[0] = what[0] = '\0'; + if (obj != uskin) { + if (uarmc) + Strcat(what, cloak_simple_name(uarmc)); + if ((obj == uarmu) && uarm) { + if (uarmc) + Strcat(what, " and "); + Strcat(what, suit_simple_name(uarm)); + } + Sprintf(why, " without taking off your %s first", what); + } else { + Strcpy(why, "; it's embedded"); + } + You_cant("take that off%s.", why); + return 0; + } reset_remarm(); /* clear context.takeoff.mask and context.takeoff.what */ (void) select_off(obj); @@ -1434,25 +1455,6 @@ dotakeoff() otmp = getobj(clothes, "take off"); if (!otmp) return 0; - if (otmp == uskin - || ((otmp == uarm) && uarmc) - || ((otmp == uarmu) && (uarmc || uarm))) { - char why[BUFSZ], what[BUFSZ]; - - why[0] = what[0] = '\0'; - if (otmp != uskin) { - if (uarmc) - Strcat(what, cloak_simple_name(uarmc)); - if ((otmp == uarmu) && uarm) { - if (uarmc) - Strcat(what, " and "); - Strcat(what, suit_simple_name(uarm)); - } - Sprintf(why, " without taking off your %s first", what); - } - You_cant("take that off%s.", why); - return 0; - } return armor_or_accessory_off(otmp); }