From: PatR Date: Thu, 27 Feb 2020 10:26:57 +0000 (-0800) Subject: botl update for trapped/untrapped X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be50da07d92b00c4018978b1a4961ed563e5ddc8;p=nethack botl update for trapped/untrapped Make set_utrap() set context.botl when changing between untrapped and trapped or vice versa. --- diff --git a/src/hack.c b/src/hack.c index 09b62b55f..68ab503ff 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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) { diff --git a/src/trap.c b/src/trap.c index a1aeb7770..0d5514d10 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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 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