From: PatR Date: Tue, 17 Nov 2020 02:08:02 +0000 (-0800) Subject: auto-cursing helmet vs perm_invent X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98075ebfe8ae6077e7f33b027aa3788ad88608d7;p=nethack auto-cursing helmet vs perm_invent 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 52d629f10..973f98992 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 diff --git a/src/do_wear.c b/src/do_wear.c index 3d20fe61f..77e7251ae 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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) {