From fd7d0f5d521f4b4e61fad6aede97eebdaa9f76c1 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 29 Nov 2019 11:14:55 -0500 Subject: [PATCH 1/3] more things considered when you're on the brink --- doc/fixes36.3 | 1 + include/extern.h | 1 + src/dig.c | 2 +- src/do.c | 9 +++++---- src/engrave.c | 3 ++- src/hack.c | 6 ++++-- src/pickup.c | 2 +- src/sit.c | 2 +- src/trap.c | 20 +++++++++++++++----- 9 files changed, 31 insertions(+), 15 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 2573be3bc..c4ce381b1 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -241,6 +241,7 @@ check for whether a monster was entering a region (gas cloud) erroneously all Is_*_level tests during early startup would test as true until dungeon_topology was initialized in a new game or restored from a save file +take holes that you avoided into consideration when you're on the brink Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository diff --git a/include/extern.h b/include/extern.h index 4316a6f62..88f71fed9 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2550,6 +2550,7 @@ E int FDECL(launch_obj, (SHORT_P, int, int, int, int, int)); E boolean NDECL(launch_in_progress); E void NDECL(force_launch_placement); E boolean FDECL(uteetering_at_seen_pit, (struct trap *)); +E boolean FDECL(uescaped_shaft, (struct trap *)); E boolean NDECL(lava_effects); E void NDECL(sink_into_lava); E void NDECL(sokoban_guilt); diff --git a/src/dig.c b/src/dig.c index dbf5eb5ca..9b91f982c 100644 --- a/src/dig.c +++ b/src/dig.c @@ -1169,7 +1169,7 @@ struct obj *obj; You("cannot stay under%s long enough.", is_pool(u.ux, u.uy) ? "water" : " the lava"); } else if ((trap = t_at(u.ux, u.uy)) != 0 - && uteetering_at_seen_pit(trap)) { + && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { dotrap(trap, FORCEBUNGLE); /* might escape trap and still be teetering at brink */ if (!u.utrap) diff --git a/src/do.c b/src/do.c index 72b315640..8b35c071f 100644 --- a/src/do.c +++ b/src/do.c @@ -246,12 +246,13 @@ const char *verb; } return water_damage(obj, NULL, FALSE) == ER_DESTROYED; } else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0 - && uteetering_at_seen_pit(t)) { + && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) { if (Blind && !Deaf) You_hear("%s tumble downwards.", the(xname(obj))); else - pline("%s %s into %s pit.", The(xname(obj)), - otense(obj, "tumble"), the_your[t->madeby_u]); + pline("%s %s into %s %s.", The(xname(obj)), + otense(obj, "tumble"), the_your[t->madeby_u], + is_pit(t->ttyp) ? "pit" : "hole"); } else if (obj->globby) { /* Globby things like puddings might stick together */ while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) { @@ -1001,7 +1002,7 @@ dodown() } if (!stairs_down && !ladder_down) { trap = t_at(u.ux, u.uy); - if (trap && uteetering_at_seen_pit(trap)) { + if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft)) { dotrap(trap, TOOKPLUNGE); return 1; } else if (!trap || !is_hole(trap->ttyp) diff --git a/src/engrave.c b/src/engrave.c index acd5247d1..b0018556f 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -154,7 +154,8 @@ boolean check_pit; if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) return FALSE; if (check_pit && !Flying - && (t = t_at(u.ux, u.uy)) != 0 && uteetering_at_seen_pit(t)) + && (t = t_at(u.ux, u.uy)) != 0 + && (uteetering_at_seen_pit(t) || uescaped_shaft(t))) return FALSE; return (boolean) ((!Levitation || Is_airlevel(&u.uz) diff --git a/src/hack.c b/src/hack.c index e615385d0..dca467262 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2635,8 +2635,10 @@ pickup_checks() } if (!can_reach_floor(TRUE)) { struct trap *traphere = t_at(u.ux, u.uy); - if (traphere && uteetering_at_seen_pit(traphere)) - You("cannot reach the bottom of the pit."); + if (traphere + && (uteetering_at_seen_pit(traphere) || uescaped_shaft(traphere))) + You("cannot reach the bottom of the %s.", + is_pit(traphere->ttyp) ? "pit" : "abyss"); else if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) rider_cant_reach(); else if (Blind && !can_reach_floor(TRUE)) diff --git a/src/pickup.c b/src/pickup.c index 4c789f38a..cd0fd118b 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -521,7 +521,7 @@ int what; /* should be a long */ if (!can_reach_floor(TRUE)) { if ((multi && !context.run) || (autopickup && !flags.pickup) || ((ttmp = t_at(u.ux, u.uy)) != 0 - && uteetering_at_seen_pit(ttmp))) + && (uteetering_at_seen_pit(ttmp) || uescaped_shaft(ttmp)))) read_engr_at(u.ux, u.uy); return 0; } diff --git a/src/sit.c b/src/sit.c index 2c164c2fe..371e1ffa6 100644 --- a/src/sit.c +++ b/src/sit.c @@ -67,7 +67,7 @@ dosit() if (OBJ_AT(u.ux, u.uy) /* ensure we're not standing on the precipice */ - && !uteetering_at_seen_pit(trap)) { + && !(uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { register struct obj *obj; obj = level.objects[u.ux][u.uy]; diff --git a/src/trap.c b/src/trap.c index 071bad6dc..fe63d2b66 100644 --- a/src/trap.c +++ b/src/trap.c @@ -5104,11 +5104,21 @@ boolean uteetering_at_seen_pit(trap) struct trap *trap; { - if (trap && trap->tseen && (!u.utrap || u.utraptype != TT_PIT) - && is_pit(trap->ttyp)) - return TRUE; - else - return FALSE; + return (trap && is_pit(trap->ttyp) && trap->tseen + && trap->tx == u.ux && trap->ty == u.uy + && !(u.utrap && u.utraptype == TT_PIT)); +} + +/* + * Returns TRUE if you didn't fall through a hole or didn't + * release a trap door + */ +boolean +uescaped_shaft(trap) +struct trap *trap; +{ + return (trap && is_hole(trap->ttyp) && trap->tseen + && trap->tx == u.ux && trap->ty == u.uy); } /* Destroy a trap that emanates from the floor. */ From 97a61e2e9571eb81038627b32b23202f9ec1fdfe Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 29 Nov 2019 12:05:21 -0500 Subject: [PATCH 2/3] move fixes entry to correct section --- doc/fixes36.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index c4ce381b1..0f584ac0e 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -241,7 +241,6 @@ check for whether a monster was entering a region (gas cloud) erroneously all Is_*_level tests during early startup would test as true until dungeon_topology was initialized in a new game or restored from a save file -take holes that you avoided into consideration when you're on the brink Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -315,6 +314,7 @@ clairvoyance showed all monsters in range, then after player viewed the map, did a normal monster refresh; the 'I' glyph step clobbers remembered object at same spot, so skip it for locations where monster refresh is going to immediately redisplay a monster +take holes that you avoided into consideration when you're on the brink unix: fix double DLB definition in linux hints file windows: fix --showpaths output for the data file which relies on being constructed programmatically to incorporate the version suffix From 49e4dfbc0f0323b3927d7bf00125405d9defb072 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 29 Nov 2019 11:38:42 -0800 Subject: [PATCH 3/3] fix teetering typo do.c:1005:54: warning: address of function 'uescaped_shaft' will always evaluate to 'true' [-Wpointer-bool-conversion] if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft)) { ~~ ^~~~~~~~~~~~~~ --- src/do.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/do.c b/src/do.c index 8b35c071f..4ea785133 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 do.c $NHDT-Date: 1574722862 2019/11/25 23:01:02 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.193 $ */ +/* NetHack 3.6 do.c $NHDT-Date: 1575056306 2019/11/29 19:38:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.195 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1002,7 +1002,7 @@ dodown() } if (!stairs_down && !ladder_down) { trap = t_at(u.ux, u.uy); - if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft)) { + if (trap && (uteetering_at_seen_pit(trap) || uescaped_shaft(trap))) { dotrap(trap, TOOKPLUNGE); return 1; } else if (!trap || !is_hole(trap->ttyp)