]> granicus.if.org Git - nethack/commitdiff
fountain vs perm_invent
authorPatR <rankin@nethack.org>
Wed, 11 Mar 2020 11:40:51 +0000 (04:40 -0700)
committerPatR <rankin@nethack.org>
Wed, 11 Mar 2020 11:40:51 +0000 (04:40 -0700)
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.

doc/fixes37.0
src/fountain.c

index 80bb4165830d4255de1b760ac74e3f489ff7afb4..f1b16f3f5ea9ee1b1d944e1ea09fb425900b24bb 100644 (file)
@@ -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
index 24bf372376f086c7d32637b7352d05c8048bc6ca..8d6d3de101428b46fc561f23bbaf1d4be17dc166 100644 (file)
@@ -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: