From 747ebf0ead0badeaea12acf27ce48d85f596c8a3 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 27 Oct 2018 19:55:18 -0700 Subject: [PATCH] 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. --- doc/fixes36.2 | 2 ++ src/end.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index ac6f516f6..fa28f3768 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -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 diff --git a/src/end.c b/src/end.c index 93216c76c..2d9c754c7 100644 --- a/src/end.c +++ b/src/end.c @@ -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); -- 2.40.0