]> granicus.if.org Git - nethack/commitdiff
fix #H260 - escaping lava let you stay there indefinitely
authornethack.rankin <nethack.rankin>
Tue, 13 Mar 2007 03:13:09 +0000 (03:13 +0000)
committernethack.rankin <nethack.rankin>
Tue, 13 Mar 2007 03:13:09 +0000 (03:13 +0000)
     <email deleted>, escaping from being stuck
by lava via jumping--or simply walking--got you out of the lava while being
at the same location.  You could then stay there for as long as you liked
without falling back in.  This makes a lava and water check on turns where
time passes but hero hasn't moved, performing a subset of spoteffects().
I think the water case only matters when using wizard mode to wish for a
pool or moat, which gets created at hero's feet without making him fall in
(unlike wishing for lava, where hero does immediately fall in).

doc/fixes34.4
include/extern.h
src/allmain.c
src/hack.c

index 04799918417232a0b2ecd23d61b5c4f1cfeaa7fc..e8691b75f917c6af94d3751c932b426066cb06a5 100644 (file)
@@ -284,6 +284,7 @@ zapping closing or breaking magic up or down from beneath an open drawbridge's
        portcullis failed if bridge orientation was north-to-south (Valk quest)
 sinking into lava didn't track passage of time properly
 sinking into lava eventually burns away slime; sitting in it always does
+after escaping lava by foot, if hero doesn't move he'll fall back in
 suppress corpse from bones data if death is due to being dissolved in lava
 suppress "you rise from the dead" if game ends due to be turned into slime
 don't give erroneous "<mon> disppears" message for hero poly'd into quantum
index 99357a47de28abef2878ab0019f549a6968c7771..690769faf0ea43ed1f48916dc3c0eeb74619473b 100644 (file)
@@ -777,6 +777,7 @@ E boolean FDECL(test_move, (int, int, int, int, int));
 E void NDECL(domove);
 E void NDECL(invocation_message);
 E void FDECL(spoteffects, (BOOLEAN_P));
+E void NDECL(stayeffects);
 E char *FDECL(in_rooms, (XCHAR_P,XCHAR_P,int));
 E boolean FDECL(in_town, (int,int));
 E void FDECL(check_special_room, (BOOLEAN_P));
index b951518e0c32d8d94f8d88e8ba303cb460b0dad9..b9d329097c3e3ab8628667c933f25d7ddec4d686 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)allmain.c  3.5     2007/02/16      */
+/*     SCCS Id: @(#)allmain.c  3.5     2007/03/12      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -321,6 +321,8 @@ boolean resuming;
                !In_endgame(&u.uz) && !BClairvoyant &&
                !(moves % 15) && !rn2(2)) do_vicinity_map();
            if (u.utrap && u.utraptype == TT_LAVA) sink_into_lava();
+           /* when/if hero escapes from lava, he can't just stay there */
+           else if (!u.umoved) stayeffects();
 
        } /* actual time passed */
 
index bd339e546b2dc837748ab91dc6d5260460d0af8d..d3d51b7f68b42987bf1142f57ff1f85d33f63f65 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)hack.c     3.5     2007/02/10      */
+/*     SCCS Id: @(#)hack.c     3.5     2007/03/12      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1741,6 +1741,27 @@ stillinwater:;
        return;
 }
 
+/* called if hero stays in the same spot while time passes */
+void
+stayeffects()
+{
+    /* leave the trickier cases to spoteffects()... */
+    if (u.uinwater) {
+       if (!is_pool(u.ux, u.uy)) spoteffects(FALSE);
+    } else if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) &&
+           !(u.ustuck || Levitation || Flying)) {
+#ifdef STEED
+       if (u.usteed)
+           spoteffects(FALSE);
+       else
+#endif
+         if (is_lava(u.ux, u.uy))
+           (void)lava_effects();
+       else if (!Wwalking)
+           (void)drown();
+    }
+}
+
 /* returns first matching monster */
 STATIC_OVL struct monst *
 monstinroom(mdat,roomno)