]> granicus.if.org Git - nethack/commitdiff
fix for 'R' on armor ignoring 'T's restrictions
authorPatR <rankin@nethack.org>
Wed, 17 Feb 2016 00:06:02 +0000 (16:06 -0800)
committerPatR <rankin@nethack.org>
Wed, 17 Feb 2016 00:06:02 +0000 (16:06 -0800)
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:
<scales object> (embedded in skin)???".

doc/fixes36.1
src/do_wear.c

index 6509afc633bb8d437d89a7d428b61501f0bcc2d0..3ea3df8fd053cfc8ae2e5e93eb9ee06dc79aa68f 100644 (file)
@@ -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
index bedda5298f28b790d1de100e7735f65d529224be..1f84aa6d8d3efc232ebf6502660ba0070760c609 100644 (file)
@@ -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);
 }