Long worm may get killed in middle of action
If long worm attacks you, and you have a passive response that may kill the worm (eg. blue jelly), the worm may die in the middle of a loop checking for a worm segment that can attack. This'll cause a segfault because the worm segments will get freed. If the worm dies, just exit the loop.
This commit is contained in:
@@ -301,7 +301,8 @@ register struct monst *worm;
|
||||
*/
|
||||
for (seg = wtails[wnum]; seg; seg = seg->nseg)
|
||||
if (distu(seg->wx, seg->wy) < 3)
|
||||
(void) mattacku(worm);
|
||||
if (mattacku(worm))
|
||||
return; /* your passive ability killed the worm */
|
||||
}
|
||||
|
||||
/* cutworm()
|
||||
|
||||
Reference in New Issue
Block a user