From 8f069744144b47bc293b362845a119ca9fb8a27a Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 30 Nov 2019 20:19:10 -0800 Subject: [PATCH] fix #H9479 - worn dented pot can't be taken off Taking off no-delay helmets, gloves, and boots were unintentionally taking off suit instead and stayed worn themselves. As far as I saw, only helmet types "fedora" and "dented pot" were applicable; all gloves and boots have a small multi-turn delay. This was an unintended side-effect of the first "slippery gloves" commit so happened about three weeks ago. --- doc/fixes36.3 | 4 +++- src/do_wear.c | 49 +++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 8fa4afc0a..375c2497c 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.192 $ $NHDT-Date: 1574882658 2019/11/27 19:24:18 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.197 $ $NHDT-Date: 1575173931 2019/12/01 04:18:51 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -320,6 +320,8 @@ update window port spec to include a color-availability table that the window function in src/windows.c which uses a few data checks only and elminates multiple string function calls for each map cell update that were being done in some cases previously +taking off a fedora or dented pot (no-delay helmets) left the helmet stuck + and took off hero's suit unix: fix double DLB definition in linux hints file windows: fix --showpaths output for the data file which relies on being constructed programmatically to incorporate the version suffix diff --git a/src/do_wear.c b/src/do_wear.c index 15959738d..afbb98fae 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do_wear.c $NHDT-Date: 1574638390 2019/11/24 23:33:10 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.114 $ */ +/* NetHack 3.6 do_wear.c $NHDT-Date: 1575173934 2019/12/01 04:18:54 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.115 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1577,28 +1577,46 @@ int armoroff(otmp) struct obj *otmp; { - register int delay = -objects[otmp->otyp].oc_delay; + static char offdelaybuf[60]; + int delay = -objects[otmp->otyp].oc_delay; + const char *what = 0; if (cursed(otmp)) return 0; + /* this used to make assumptions about which types of armor had + delays and which didn't; now both are handled for all types */ if (delay) { nomul(delay); multi_reason = "disrobing"; if (is_helmet(otmp)) { /* ick... */ - nomovemsg = !strcmp(helm_simple_name(otmp), "hat") - ? "You finish taking off your hat." - : "You finish taking off your helmet."; + what = helm_simple_name(otmp); afternmv = Helmet_off; } else if (is_gloves(otmp)) { - nomovemsg = "You finish taking off your gloves."; + what = gloves_simple_name(otmp); afternmv = Gloves_off; } else if (is_boots(otmp)) { - nomovemsg = "You finish taking off your boots."; + what = c_boots; afternmv = Boots_off; - } else { - nomovemsg = "You finish taking off your suit."; + } else if (is_suit(otmp)) { + what = suit_simple_name(otmp); afternmv = Armor_off; + } else if (is_cloak(otmp)) { + what = cloak_simple_name(otmp); + afternmv = Cloak_off; + } else if (is_shield(otmp)) { + what = c_shield; + afternmv = Shield_off; + } else if (is_shirt(otmp)) { + what = c_shirt; + afternmv = Shirt_off; + } else { + impossible("Taking off unknown armor (%d: %d), delay %d", + otmp->otyp, objects[otmp->otyp].oc_armcat, delay); + } + if (what) { + Sprintf(offdelaybuf, "You finish taking off your %s.", what); + nomovemsg = offdelaybuf; } } else { /* Be warned! We want off_msg after removing the item to @@ -1622,8 +1640,19 @@ struct obj *otmp; (void) Cloak_off(); else if (is_shield(otmp)) (void) Shield_off(); - else + else if (is_helmet(otmp)) + (void) Helmet_off(); + else if (is_gloves(otmp)) + (void) Gloves_off(); + else if (is_boots(otmp)) + (void) Boots_off(); + else if (is_shirt(otmp)) + (void) Shirt_off(); + else if (is_suit(otmp)) (void) Armor_off(); + else + impossible("Taking off unknown armor (%d: %d), no delay", + otmp->otyp, objects[otmp->otyp].oc_armcat); off_msg(otmp); } context.takeoff.mask = context.takeoff.what = 0L; -- 2.49.0