]> granicus.if.org Git - nethack/commitdiff
B02002 - drawbridge vs longworm
authorcohrs <cohrs>
Thu, 27 Nov 2003 17:37:38 +0000 (17:37 +0000)
committercohrs <cohrs>
Thu, 27 Nov 2003 17:37:38 +0000 (17:37 +0000)
If a long worm's head is on the drawbridge and a tail segment is at the
portcullis and you raise the drawbridge, bad monster handling occurs
because of some recursion that occurs before set_entity is called again.
Not sure when this last worked; it's broken in 3.4.2 as well.  Modified
e_died to ensure both entity objects for the same monster get cleaned up
so subsequent e_at calls behave as expected.

doc/fixes34.3
src/dbridge.c

index 5233a7556cc94a9e562042ee721d6cdf848ace48..bec10e46ee295833ca61580a615da01aeeb6f8f4 100644 (file)
@@ -95,6 +95,7 @@ resuming interrupted 'A' sometimes ended with "You finished disrobing" twice
 when you're asleep you shouldn't "notice" monsters that have become undetected
 must be able to reach floor in order to use stethoscope on corpse or statue
 fix a few coordinate (y,y) -> (x,y) typos in apply.c, mon.c, and wizard.c
+killing a long worm on a drawbridge could produce a panic
 
 
 Platform- and/or Interface-Specific Fixes
index 53b9878254d519343fa3663231a92f81a5f1e74a..fa7020e5d8e7b38dc75e0897024bc97e6eea7ce2 100644 (file)
@@ -399,6 +399,8 @@ int dest, how;
                /* we might have crawled out of the moat to survive */
                etmp->ex = u.ux,  etmp->ey = u.uy;
        } else {
+               int entitycnt;
+
                killer.name[0] = 0;
                /* fake "digested to death" damage-type suppresses corpse */
 #define mk_message(dest) ((dest & 1) ? "" : (char *)0)
@@ -409,6 +411,13 @@ int dest, how;
                else            /* you caused it */
                    xkilled(etmp->emon, dest);
                etmp->edata = (struct permonst *)0;
+
+               /* dead long worm handling */
+               for (entitycnt = 0; entitycnt < ENTITIES; entitycnt++) {
+                   if (etmp != &(occupants[entitycnt]) &&
+                       etmp->emon == occupants[entitycnt].emon)
+                       occupants[entitycnt].edata = (struct permonst *)0;
+               }
 #undef mk_message
 #undef mk_corpse
        }