]> granicus.if.org Git - nethack/commitdiff
fix #H265 - applying wielded towel fails with odd message
authornethack.rankin <nethack.rankin>
Thu, 15 Mar 2007 06:04:08 +0000 (06:04 +0000)
committernethack.rankin <nethack.rankin>
Thu, 15 Mar 2007 06:04:08 +0000 (06:04 +0000)
     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
src/apply.c

index 9757dd17ff489a17c6166b67c3d77b7e4da03a89..47e8a23eb55640bddb98e76451f0dade2d00959a 100644 (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
index 3bb57f08cdd6a02f3f740d214e775825c566743e..58c36bc454df3339efc8c0902fdb8047546c9d82 100644 (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");