]> granicus.if.org Git - nethack/commitdiff
auto-cursing helmet vs perm_invent
authorPatR <rankin@nethack.org>
Tue, 17 Nov 2020 02:08:02 +0000 (18:08 -0800)
committerPatR <rankin@nethack.org>
Tue, 17 Nov 2020 02:08:02 +0000 (18:08 -0800)
I though that I noticed a problem but later couldn't reproduce
it, so this might not be redundant.  Update persistent inventory
when putting on a helmet causes it to become cursed.

Minor change:  if blind at the time, hero loses knowledge of BUC
state.

doc/fixes37.0
src/do_wear.c

index 52d629f107a73aab6a3d2c0a1758067d1440a057..973f9899267f781adc55da7c448ab0a6452cdf8b 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.353 $ $NHDT-Date: 1605316497 2020/11/14 01:14:57 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.354 $ $NHDT-Date: 1605578879 2020/11/17 02:07:59 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -295,6 +295,7 @@ hero could break a wand ("raising the wand high over your head, you break it
        one-handed weapon and also to a shield
 if a monster threw a cocktrice egg at the hero but hit and petrified another
        monster, the hero would get credit/blame for killing it
+update persistent inventory when putting on a helmet causes it to auto-curse
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 3d20fe61f55829ecc3c0a3e6d7e25f6a11886cfd..77e7251ae2a8d2d16a7147b599121767ddede004 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 do_wear.c       $NHDT-Date: 1598958650 2020/09/01 11:10:50 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */
+/* NetHack 3.7 do_wear.c       $NHDT-Date: 1605578866 2020/11/17 02:07:46 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.136 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -424,6 +424,14 @@ Helmet_on(VOID_ARGS)
                 pline("%s %s for a moment.", Tobjnam(uarmh, "glow"),
                       hcolor(NH_BLACK));
             curse(uarmh);
+            /* curse() doesn't touch bknown so doesn't update persistent
+               inventory; do so now [set_bknown() calls update_inventory()] */
+            if (Blind)
+                set_bknown(uarmh, 0); /* lose bknown if previously set */
+            else if (Role_if(PM_PRIEST))
+                set_bknown(uarmh, 1); /* (bknown should already be set) */
+            else if (uarmh->bknown)
+                update_inventory(); /* keep bknown as-is; display the curse */
         }
         g.context.botl = 1; /* reveal new alignment or INT & WIS */
         if (Hallucination) {