]> granicus.if.org Git - nethack/commitdiff
Fix: engraving with non-blade dulled the weapon anyway
authorcopperwater <aosdict@gmail.com>
Fri, 19 Feb 2021 05:25:45 +0000 (00:25 -0500)
committercopperwater <aosdict@gmail.com>
Fri, 19 Feb 2021 05:25:45 +0000 (00:25 -0500)
Due to a logic bug introduced when engraving became an occupation - the
code that tests to see whether the player is writing with a weapon that
will get dulled wasn't correctly checking that they were actually
carving an engraving.

src/engrave.c

index 9acb246edf1f47289f5de99f2e65113c2d440d0f..5926a4dd2e4af2cc749089efd330d79e4b78d8b1 100644 (file)
@@ -1133,15 +1133,15 @@ engrave(void)
         }
     }
 
-    dulling_wep = (stylus && stylus->oclass == WEAPON_CLASS
+    dulling_wep = (carving && stylus && stylus->oclass == WEAPON_CLASS
                    && (stylus->otyp != ATHAME || stylus->cursed));
     marker = (stylus && stylus->otyp == MAGIC_MARKER);
 
     g.context.engraving.actionct++;
 
     /* sanity checks */
-    if (dulling_wep && !carving) {
-        impossible("using weapon for non-carve engraving");
+    if (dulling_wep && !is_blade(stylus)) {
+        impossible("carving with non-bladed weapon");
     }
     else if (g.context.engraving.type == MARK && !marker) {
         impossible("making graffiti with non-marker stylus");