fix #H7487 - dead with non-zero HP

Report was for being fried by angry deity.  There are lots of deaths
that don't involve subtracting HP until it hits 0 or less; I haven't
bothered tracking down which ones don't set u.uhp to 0 before they
call done().

No effect on life-saving or declining to die except for HP:0 being
visible on the status line during their messages.
This commit is contained in:
PatR
2018-10-27 19:55:18 -07:00
parent d77ecd4ae5
commit 747ebf0ead
2 changed files with 12 additions and 1 deletions

View File

@@ -176,6 +176,8 @@ prayer result which enhanced strength (fix weakness from hunger) didn't give
a message if a change in encumbrance occurred; it came on next move
add current location within the dungeon to the Background section of ^X and
final disclosure (it's not background but doesn't fit anywhere else)
death from something other than loss of hit points could leave hero with
non-zero HP at end of game (during "really die?" prompt, disclosure)
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository

View File

@@ -1037,8 +1037,17 @@ int how;
if (!killer.name[0] || how >= PANICKED)
Strcpy(killer.name, deaths[how]);
if (how < PANICKED)
if (how < PANICKED) {
u.umortality++;
/* in case caller hasn't already done this */
if (u.uhp > 0 || (Upolyd && u.mh > 0)) {
/* for deaths not triggered by loss of hit points, force
current HP to zero (0 HP when turning into green slime
is iffy but we don't have much choice--that is fatal) */
u.uhp = u.mh = 0;
context.botl = 1;
}
}
if (Lifesaved && (how <= GENOCIDED)) {
pline("But wait...");
makeknown(AMULET_OF_LIFE_SAVING);