]> granicus.if.org Git - nethack/commitdiff
'A' vs blindfold
authorPatR <rankin@nethack.org>
Thu, 11 May 2017 23:26:35 +0000 (16:26 -0700)
committerPatR <rankin@nethack.org>
Thu, 11 May 2017 23:26:35 +0000 (16:26 -0700)
Fix an inconsistency with blindfold removal, eliminating possibility
of a panic (3.6.0) or an impossible (since mid-December, 2016).  The
'A' command treated blindfold removal as a multi-turn operation, the
rest of the wear/unwear code as single-turn operation so didn't try
to guard against it being disrupted.

doc/fixes36.1
src/do_wear.c

index ddad2f3712b5b201df7d26738940ed983c0ebdfe..f0da1ea2d2ee5ce71715642d88df0fa00e45374a 100644 (file)
@@ -378,6 +378,8 @@ levitation vs encumbrance message sequencing issues:  putting on boots of
        levitation reported reduction of encumbrance before finish-wearing
        and float-up messages, taking off such boots didn't report increase
        of encumbrance until player took another action
+removing a blindfold with 'A' took two turns, with 'R' (and 'T') only one,
+       and could result in a panic if the blindfold was stolen during removal
 
 
 Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository
index f0c1038dc38b2abbdcbed31a0841bab0ed6acc64..e60df04dccad5e0a5af684ac0aee886ed5bb0bf6 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 do_wear.c       $NHDT-Date: 1494107204 2017/05/06 21:46:44 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.94 $ */
+/* NetHack 3.6 do_wear.c       $NHDT-Date: 1494545163 2017/05/11 23:26:03 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.95 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1231,6 +1231,16 @@ struct obj *otmp;
     else if (otmp == uarms)
         result = (afternmv == Shield_on || afternmv == Shield_off
                   || what == WORN_SHIELD);
+    /* these 1-turn items don't need 'afternmv' checks
+       [and may not actually need 'what' checks] */
+    else if (otmp == uamul)
+        result = (what == WORN_AMUL);
+    else if (otmp == uleft)
+        result = (what == LEFT_RING);
+    else if (otmp == uright)
+        result = (what == RIGHT_RING);
+    else if (otmp == ublindf)
+        result = (what == WORN_BLINDF);
 
     return result;
 }
@@ -1259,6 +1269,16 @@ struct obj *otmp;
         result = (afternmv == Gloves_off || what == WORN_GLOVES);
     else if (otmp == uarms)
         result = (afternmv == Shield_off || what == WORN_SHIELD);
+    /* these 1-turn items don't need 'afternmv' checks
+       [and may not actually need 'what' checks] */
+    else if (otmp == uamul)
+        result = (what == WORN_AMUL);
+    else if (otmp == uleft)
+        result = (what == LEFT_RING);
+    else if (otmp == uright)
+        result = (what == RIGHT_RING);
+    else if (otmp == ublindf)
+        result = (what == WORN_BLINDF);
 
     return result;
 }
@@ -2427,7 +2447,9 @@ take_off(VOID_ARGS)
     } else if (doff->what == RIGHT_RING) {
         doff->delay = 1;
     } else if (doff->what == WORN_BLINDF) {
-        doff->delay = 2;
+        /* [this used to be 2, but 'R' (and 'T') only require 1 turn to
+           remove a blindfold, so 'A' shouldn't have been requiring 2] */
+        doff->delay = 1;
     } else {
         impossible("take_off: taking off %lx", doff->what);
         return 0; /* force done */