]> granicus.if.org Git - nethack/commitdiff
Fix punishment iron ball yanking hero on top of a monster
authorPasi Kallinen <paxed@alt.org>
Fri, 3 Feb 2023 06:23:31 +0000 (08:23 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 3 Feb 2023 06:51:48 +0000 (08:51 +0200)
When attached iron ball was in a pit (or a pool) with a monster,
and your levitation ended, you were put on top of the monster.

Add a sanity check for hero over monster.

doc/fixes3-7-0.txt
src/cmd.c
src/trap.c

index 38cdabe4207556d47969ec72d0ea265bb92a7b56..b3e5b3a39a8af930d89f95c65af787717e38785b 100644 (file)
@@ -1103,6 +1103,7 @@ give gremlin the property it stole, if possible
 'F'orcefighting with a war hammer has a small chance of breaking iron bars
 very rarely random items are generated eroded, erodeproof, or greased
 Nazgul can see invisible
+fix a case where punished iron ball yanked hero on top of a monster
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index f464b5243effad8723866dc179c156eb74e53c20..d2aab63456710c5a1a96973ea56d301d0f3ce865 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -4177,6 +4177,8 @@ wiz_mon_diff(void)
 static void
 you_sanity_check(void)
 {
+    struct monst *mtmp;
+
     if (u.uswallow && !u.ustuck) {
         /* this probably ought to be panic() */
         impossible("sanity_check: swallowed by nothing?");
@@ -4186,6 +4188,12 @@ you_sanity_check(void)
         u.uswldtim = 0;
         docrt();
     }
+    if ((mtmp = m_at(u.ux, u.uy)) != 0) {
+        /* u.usteed isn't on the map */
+        if (u.ustuck != mtmp)
+            impossible("sanity_check: you over monster");
+    }
+
     (void) check_invent_gold("invent");
 }
 
index df10177ae6d70cdbfaf69845a580ab89ed59948a..0ebc185881986c40b292544f8352251046ed93b0 100644 (file)
@@ -3560,7 +3560,7 @@ float_down(
         return 1;
     }
 
-    if (Punished && !carried(uball)
+    if (Punished && !carried(uball) && !m_at(uball->ox, uball->oy)
         && (is_pool(uball->ox, uball->oy)
             || ((trap = t_at(uball->ox, uball->oy))
                 && (is_pit(trap->ttyp) || is_hole(trap->ttyp))))) {