]> granicus.if.org Git - nethack/commitdiff
fix github issue #159 - eating nurse corpses
authorPatR <rankin@nethack.org>
Tue, 13 Nov 2018 23:05:54 +0000 (15:05 -0800)
committerPatR <rankin@nethack.org>
Tue, 13 Nov 2018 23:05:54 +0000 (15:05 -0800)
Fixes #159

The nurse monster definition is flagged to be able to convery poison
resistance when a corpse or tin is eaten, but the post-corpse code
for nurse healed HP and cured blindness then skipped the intrinsic
handling.

doc/fixes36.2
src/eat.c

index fb2cf76b0deb528eddc59481aa6f30b03f45c0b5..79b7520a46c8ab178c32b6f483e371dc2ffccbb4 100644 (file)
@@ -196,6 +196,7 @@ avoid potential buffer overflow if object with very long name knocks other
 #wizintrinsic for 'warn_of_mon' didn't set any type of monster (now grid bugs)
 clairvoyance would show trap instead of a monster on/in that trap, which was
        intentional, but when clairvoyance finished the monster wasn't shown
+nurse corpse/tin chance to convey poison resistance when eaten was not honored
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index 0d5e83ab2f068ce3f0105e5b539bb2dfba6f8da9..0d9df6ce7aca90fa0bfac707c6d1afa68cb02028 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -943,10 +943,11 @@ register struct permonst *ptr;
 /* called after completely consuming a corpse */
 STATIC_OVL void
 cpostfx(pm)
-register int pm;
+int pm;
 {
-    register int tmp = 0;
+    int tmp = 0;
     int catch_lycanthropy = NON_PM;
+    boolean check_intrinsics = FALSE;
 
     /* in case `afternmv' didn't get called for previously mimicking
        gold, clean up now to avoid `eatmbuf' memory leak */
@@ -958,6 +959,7 @@ register int pm;
         /* MRKR: "eye of newt" may give small magical energy boost */
         if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
             int old_uen = u.uen;
+
             u.uen += rnd(3);
             if (u.uen > u.uenmax) {
                 if (!rn2(3))
@@ -989,6 +991,7 @@ register int pm;
             u.uhp = u.uhpmax;
         make_blinded(0L, !u.ucreamed);
         context.botl = 1;
+        check_intrinsics = TRUE; /* might also convey poison resistance */
         break;
     case PM_STALKER:
         if (!Invis) {
@@ -1090,7 +1093,13 @@ register int pm;
             pline("For some reason, that tasted bland.");
         }
     /*FALLTHRU*/
-    default: {
+    default:
+        check_intrinsics = TRUE;
+        break;
+    }
+
+    /* possibly convey an intrinsic */
+    if (check_intrinsics) {
         struct permonst *ptr = &mons[pm];
         boolean conveys_STR = is_giant(ptr);
         int i, count;
@@ -1137,9 +1146,7 @@ register int pm;
             gainstr((struct obj *) 0, 0, TRUE);
         else if (tmp > 0)
             givit(tmp, ptr);
-        break;
-    } /* default case */
-    } /* switch */
+    } /* check_intrinsics */
 
     if (catch_lycanthropy >= LOW_PM) {
         set_ulycn(catch_lycanthropy);