]> granicus.if.org Git - nethack/commitdiff
Apply trap door destination restrictions in dodown
authorMichael Meyer <me@entrez.cc>
Thu, 22 Sep 2022 01:25:25 +0000 (21:25 -0400)
committerPasi Kallinen <paxed@alt.org>
Thu, 22 Sep 2022 08:36:48 +0000 (11:36 +0300)
Missed this way to use the trap door (in a block added in 05761ba) in
previous commits, though I'm a little confused about whether that block
in dodown is even reachable given how various trap scenarios are handled
with dotrap earlier in the function.

src/do.c

index 17dcf6dfaa7d4d43d72c9d8cbea446db583ecf4f..3f1ee04c3892c4831736ad9e8d07d0e86ce5de2f 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1145,8 +1145,11 @@ dodown(void)
     }
     if (trap && Is_stronghold(&u.uz)) {
         goto_hell(FALSE, TRUE);
-    } else if (trap) {
-        goto_level(&(trap->dst), FALSE, FALSE, FALSE);
+    } else if (trap && trap->dst.dlevel != -1) {
+        d_level tdst;
+        assign_level(&tdst, &(trap->dst));
+        (void) clamp_hole_destination(&tdst);
+        goto_level(&tdst, FALSE, FALSE, FALSE);
     } else {
         g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
         next_level(!trap);