From a2a5df0932e66d136efee608c0146cfdfab29ced Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 15 Mar 2007 06:04:08 +0000 Subject: [PATCH] fix #H265 - applying wielded towel fails with odd message From a bug report: attempting to apply a towel which is currently "worn" in the weapon, alternate weapon, or quiver slot fails with "you cannot use it while you're wearing it". The message sounds odd when the towel is wielded, and there's no reason why you shouldn't be able to use it when it's in any of those weapon slots. Compare it with current blindfold rather than checking its owornmask. --- doc/fixes34.4 | 1 + src/apply.c | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 9757dd17f..47e8a23eb 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -336,6 +336,7 @@ when shopkeeper "gratefully inherits possessions" of hero who dies in shop doorway without owing the shop, move those items inside shop for bones dying in a shop while wielding two weapons could cause "Setworn: mask" warning make score file processing more bullet proof to avoid potential security issue +towel equipped in weapon, alternate weapon, or quiver slot can be applied Platform- and/or Interface-Specific Fixes diff --git a/src/apply.c b/src/apply.c index 3bb57f08c..58c36bc45 100644 --- a/src/apply.c +++ b/src/apply.c @@ -92,7 +92,7 @@ use_towel(obj) if(!freehand()) { You("have no free %s!", body_part(HAND)); return 0; - } else if (obj->owornmask) { + } else if (obj == ublindf) { You("cannot use it while you're wearing it!"); return 0; } else if (obj->cursed) { @@ -112,8 +112,11 @@ use_towel(obj) (old ? "has more" : "now has")); make_blinded(Blinded + (long)u.ucreamed - old, TRUE); } else { - const char *what = (ublindf->otyp == LENSES) ? - "lenses" : "blindfold"; + const char *what; + + what = (ublindf->otyp == LENSES) ? "lenses" : + (obj->otyp == ublindf->otyp) ? "other towel" : + "blindfold"; if (ublindf->cursed) { You("push your %s %s.", what, rn2(2) ? "cock-eyed" : "crooked"); -- 2.40.0