]> granicus.if.org Git - nethack/commitdiff
Avoid repeating the god ray
authorPasi Kallinen <paxed@alt.org>
Mon, 30 Jan 2023 10:39:32 +0000 (12:39 +0200)
committerPasi Kallinen <paxed@alt.org>
Mon, 30 Jan 2023 10:39:35 +0000 (12:39 +0200)
My recent change to hit and wake monsters caused a recursive
ghod_hitsu -> wakeup -> dobuzz -> buzz -> ghod_hitsu loop.
Don't call the ghod_hitsu again if the priest is already angry.

src/mon.c

index 718b4def44266787ae7bb84ec99291787dac793c..af2e7f73467ee510681ef7d80b238f58aed74aea 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -3819,13 +3819,17 @@ wakeup(struct monst* mtmp, boolean via_attack)
     }
     finish_meating(mtmp);
     if (via_attack) {
+        boolean was_peaceful = mtmp->mpeaceful;
+
         if (was_sleeping)
             growl(mtmp);
         setmangry(mtmp, TRUE);
-        if (mtmp->ispriest && *in_rooms(mtmp->mx, mtmp->my, TEMPLE))
-            ghod_hitsu(mtmp);
-        if (mtmp->isshk && !*u.ushops)
-            hot_pursuit(mtmp);
+        if (was_peaceful) {
+            if (mtmp->ispriest && *in_rooms(mtmp->mx, mtmp->my, TEMPLE))
+                ghod_hitsu(mtmp);
+            if (mtmp->isshk && !*u.ushops)
+                hot_pursuit(mtmp);
+        }
     }
 }