From 4ed0e5fd6d4d92c542d2a7dd5ec77e8cbaf7487c Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 11 May 2017 16:26:35 -0700 Subject: [PATCH] 'A' vs blindfold 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 | 2 ++ src/do_wear.c | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index ddad2f371..f0da1ea2d 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -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 diff --git a/src/do_wear.c b/src/do_wear.c index f0c1038dc..e60df04dc 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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 */ -- 2.50.1