]> granicus.if.org Git - nethack/commitdiff
botl update for trapped/untrapped
authorPatR <rankin@nethack.org>
Thu, 27 Feb 2020 10:26:57 +0000 (02:26 -0800)
committerPatR <rankin@nethack.org>
Thu, 27 Feb 2020 10:26:57 +0000 (02:26 -0800)
Make set_utrap() set context.botl when changing between untrapped and
trapped or vice versa.

src/hack.c
src/trap.c

index 09b62b55f90269838283756e58dd76dae3f11bd2..68ab503ffc402f2a26c4d50cc4f2dba81e81f027 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 hack.c  $NHDT-Date: 1581886860 2020/02/16 21:01:00 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
+/* NetHack 3.6 hack.c  $NHDT-Date: 1582799171 2020/02/27 10:26:11 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1749,8 +1749,10 @@ domove_core()
     if (u.utrap) {
         boolean moved = trapmove(x, y, trap);
 
-        if (!u.utrap)
+        if (!u.utrap) {
+            g.context.botl = TRUE;
             reset_utrap(TRUE); /* might resume levitation or flight */
+        }
         /* might not have escaped, or did escape but remain in same spot */
         if (!moved)
             return;
@@ -1965,7 +1967,7 @@ domove_core()
         /* display every step or every 7th step depending upon mode */
         if (flags.runmode != RUN_LEAP || !(g.moves % 7L)) {
             if (flags.time)
-                g.context.botl = 1;
+                iflags.time_botl = 1;
             curs_on_u();
             delay_output();
             if (flags.runmode == RUN_CRAWL) {
index a1aeb7770f2e02959c8e1929ee214e25fadea05a..0d5514d10b83debeb1c84ffab990d0c9b3910419 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 trap.c  $NHDT-Date: 1581886868 2020/02/16 21:01:08 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.351 $ */
+/* NetHack 3.6 trap.c  $NHDT-Date: 1582799195 2020/02/27 10:26:35 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.353 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -326,8 +326,9 @@ int x, y, typ;
         if (u.utrap && x == u.ux && y == u.uy
             && ((u.utraptype == TT_BEARTRAP && typ != BEAR_TRAP)
                 || (u.utraptype == TT_WEB && typ != WEB)
-                || (u.utraptype == TT_PIT && !is_pit(typ))))
-            u.utrap = 0;
+                || (u.utraptype == TT_PIT && !is_pit(typ))
+                || (u.utraptype == TT_LAVA && !is_lava(x, y))))
+            reset_utrap(FALSE);
         /* old <tx,ty> remain valid */
     } else if (IS_FURNITURE(lev->typ)
                && (!IS_GRAVE(lev->typ) || (typ != PIT && typ != HOLE))) {
@@ -866,6 +867,12 @@ void
 set_utrap(tim, typ)
 unsigned tim, typ;
 {
+    /* if we get here through reset_utrap(), the caller of that might
+       have already set u.utrap to 0 so this check won't be sufficient
+       in that situation; caller will need to set context.botl itself */
+    if (!u.utrap ^ !tim)
+        g.context.botl = TRUE;
+
     u.utrap = tim;
     /* FIXME:
      * utraptype==0 is bear trap rather than 'none'; we probably ought