From: PatR Date: Wed, 11 Mar 2020 11:40:51 +0000 (-0700) Subject: fountain vs perm_invent X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7b301537fae9f6ee1471183647dd3dc6b99500e;p=nethack fountain vs perm_invent From a reddit thread. Quaffing from a fountain can curse some of hero's inventory, but when doing so it wasn't updating the persistent inventory window if that was enabled. It could also set the cursed flag on goid pieces; so could dipping. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 80bb41658..f1b16f3f5 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.127 $ $NHDT-Date: 1583881126 2020/03/10 22:58:46 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.128 $ $NHDT-Date: 1583926845 2020/03/11 11:40:45 $ General Fixes and Modified Features ----------------------------------- @@ -73,6 +73,8 @@ if the orc-town version of mine town has been loaded, creation of orc zombies when punished, involuntarily teleporting and landing within chain range of attached ball while encumbered worse than burdened could trigger "remove_object: obj not on floor" panic on hero's next move +inventory cursing caused by "this water's no good" effect when drinking from + a fountain didn't update persistent inventory window Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/fountain.c b/src/fountain.c index 24bf37237..8d6d3de10 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 fountain.c $NHDT-Date: 1544442711 2018/12/10 11:51:51 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */ +/* NetHack 3.6 fountain.c $NHDT-Date: 1583926845 2020/03/11 11:40:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.67 $ */ /* Copyright Scott R. Turner, srt@ucla, 10/27/86 */ /* NetHack may be freely redistributed. See license for details. */ @@ -293,15 +293,21 @@ drinkfountain() case 23: /* Water demon */ dowaterdemon(); break; - case 24: /* Curse an item */ { + case 24: { /* Maybe curse some items */ register struct obj *obj; + int buc_changed = 0; pline("This water's no good!"); morehungry(rn1(20, 11)); exercise(A_CON, FALSE); + /* this is more severe than rndcurse() */ for (obj = g.invent; obj; obj = obj->nobj) - if (!rn2(5)) + if (obj->oclass != COIN_CLASS && !obj->cursed && !rn2(5)) { curse(obj); + ++buc_changed; + } + if (buc_changed) + update_inventory(); break; } case 25: /* See invisible */ @@ -416,7 +422,9 @@ register struct obj *obj; switch (rnd(30)) { case 16: /* Curse the item */ - curse(obj); + if (obj->oclass != COIN_CLASS && !obj->cursed) { + curse(obj); + } break; case 17: case 18: