]> granicus.if.org Git - nethack/commit
fix #H1826 - split long worm with 0 hit points
authornethack.rankin <nethack.rankin>
Fri, 6 Mar 2009 02:22:14 +0000 (02:22 +0000)
committernethack.rankin <nethack.rankin>
Fri, 6 Mar 2009 02:22:14 +0000 (02:22 +0000)
commit077606bc0184a85c4574d8ffb68305d842d896fa
tree409c223f1f49909178fbf0d3b4717dd68ad699b3
parentb76f8aab8dfde646fdf46a3fd908c937b6a62954
fix #H1826 - split long worm with 0 hit points

     From a bug report, a long worm with 0 HP
was observed via stethoscope after cutting one or more worms in half many
times, followed by an unspecified crash.  Cutting a worm doesn't reduce
its level below 3, but if a worm is drained to level 0 by some other means
and then gets cut in half (and still has at least 2 HP left), cutworm()
would give the new level 0 worm 0d8 (hence 0) for current and max HP.
That could confuse end-of-move monster cleanup, which thinks 0 HP is a
dead monster who has been removed from the map but not yet purged from the
fmon list.  Purging it would then leave a stale monster pointer on the map.

     cutworm() should have special cased level 0 to use 1d4 for HP, but
instead I've changed it to not produce a cloned worm if the source one is
lower than level 3.
doc/fixes34.4
src/worm.c