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.
This commit is contained in:
nethack.rankin
2007-03-15 06:04:08 +00:00
parent cba99b52c3
commit a2a5df0932
2 changed files with 7 additions and 3 deletions

View File

@@ -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

View File

@@ -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");