]> granicus.if.org Git - nethack/commitdiff
Fix bug C343-20 wrong level shown at death
authornhmall <mjnh@persona.ca>
Fri, 18 Dec 2015 01:27:42 +0000 (20:27 -0500)
committernhmall <mjnh@persona.ca>
Fri, 18 Dec 2015 01:27:42 +0000 (20:27 -0500)
 Changes to be committed:
modified:   doc/fixes36.1
modified:   src/ball.c

I looked up the original bug report that led to bug page C343-20
"When dying immediately on entering a level, the map may show you dying on the previous level."

It was received public report U891:
> When one is being punished and goes down a staircase and dies because the
> ball and chain fell on their head, one gets the message about their death
> while the old level is still being displayed. I wasn't sure whether this
> was a bug or not because on one hand it wouldn't make much sense to
> generate a new level if the character is going to die anyway. However,
> that being said it does make a difference if the character is about to go
> down into a level where one cannot leave bones files, ie medusa or the
> first level of the mines (if i remember correctly). So, if your character
> dies from this does the bones file get left on the level you were on
> (which is still displayed at the time of death) or the level you died as
> soon as you got to (but was never displayed)? Thanks!

Pat had remarked in response: "So this is just a display issue; game play works as intended
(for the program; I imagine you weren't planning to get killed."

A debug trace in wizard mode 3.6.1 beta shows that the relevant code path is this:
NetHack.exe!done(int how) Line 908
NetHack.exe!losehp(int n, const char * knam, char k_format) Line 2678
NetHack.exe!drag_down(...) Line 823
NetHack.exe!goto_level(d_level * newlevel, char at_stairs, char falling, char portal) Line 1316
NetHack.exe!next_level(char at_stairs) Line 1157
NetHack.exe!dodown(...) Line 954
NetHack.exe!rhack(char * cmd) Line 3416
NetHack.exe!moveloop(char resuming) Line 464
NetHack.exe!main(int argc, char * * argv) Line 104

This patch clears the display for the situation in drag_down(),
so the old level is not shown.

doc/fixes36.1
src/ball.c

index 80dabedc865b5cb5337dec82a948aabae5492224..f68b47feedf6795a19e8ed199d8a20849818416f 100644 (file)
@@ -36,6 +36,8 @@ make a previously-discovered scroll written with marker while blind have its
        label known so it can be read while blind
 #name or C for discoveries list that spanned multiple pages would exit on
        space instead of advancing to next page (workaround: use '>' instead)
+don't show the old level when you die going down the stairs because of an 
+        iron ball
 
 
 Platform- and/or Interface-Specific Fixes
index 1a35eea1c8abedbdcd6312023487836af0d51fac..a4f148395b9cbbc38a9677f187e3626440e35a4e 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 ball.c  $NHDT-Date: 1446808438 2015/11/06 11:13:58 $  $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */
+/* NetHack 3.6 ball.c  $NHDT-Date: 1450402033 2015/12/18 01:27:13 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.29 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -809,6 +809,9 @@ drag_down()
     if (carried(uball))
         You("lose your grip on the iron ball.");
 
+    cls();  /* previous level is still displayed although you
+               went down the stairs. Avoids bug C343-20 */
+
     if (forward) {
         if (rn2(6)) {
             pline_The("iron ball drags you downstairs!");