]> granicus.if.org Git - nethack/commitdiff
refine setworn()'s impossible()
authorPatR <rankin@nethack.org>
Sat, 9 Apr 2022 18:40:47 +0000 (11:40 -0700)
committerPatR <rankin@nethack.org>
Sat, 9 Apr 2022 18:40:47 +0000 (11:40 -0700)
If setworn() issues "Setworn: mask = 1234.", format the number in
hexadecimal so that the high bits are easier to decipher.  Noticed
when experimenting with ball and chain where the decimal values of
their worn-masks are beyond the range of powers of 2 I recognize.

src/worn.c

index 92299d3ca58d18b7c841e35a5131c8c4d6470332..1040715e465bb3eddbb16198aed4b5d00b071a92 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 worn.c  $NHDT-Date: 1646260985 2022/03/02 22:43:05 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.81 $ */
+/* NetHack 3.7 worn.c  $NHDT-Date: 1649529637 2022/04/09 18:40:37 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.82 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -58,7 +58,7 @@ setworn(struct obj *obj, long mask)
             if (wp->w_mask & mask) {
                 oobj = *(wp->w_obj);
                 if (oobj && !(oobj->owornmask & wp->w_mask))
-                    impossible("Setworn: mask = %ld.", wp->w_mask);
+                    impossible("Setworn: mask=0x%08lx.", wp->w_mask);
                 if (oobj) {
                     if (u.twoweap && (oobj->owornmask & (W_WEP | W_SWAPWEP)))
                         set_twoweap(FALSE); /* u.twoweap = FALSE */