]> granicus.if.org Git - nethack/commitdiff
boulder path for rolling boulder trap
authorPatR <rankin@nethack.org>
Sun, 14 Mar 2021 22:12:46 +0000 (15:12 -0700)
committerPatR <rankin@nethack.org>
Sun, 14 Mar 2021 22:12:46 +0000 (15:12 -0700)
Reported six and a half years ago (by paxed), don't use a boulder
path start starts up a pit or hole.  Extended to avoid teleport
too.

doc/fixes37.0
include/trap.h
src/trap.c

index aa1e7ba68af69e2603963129586ab5cb9500bff4..ed77deac7e3a01e892ef3fc71a6439ce494f1717 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.469 $ $NHDT-Date: 1615304752 2021/03/09 15:45:52 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.474 $ $NHDT-Date: 1615759956 2021/03/14 22:12:36 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -403,6 +403,9 @@ key parsing during options processing was inconsistent between OPTIONS=foo:k
        recognized backslash escape sequences but not M-x meta characters,
        vice versa for BINDINGS (most noticeable for menu interaction keys
        such as menu_next_page because those can be set via either directive)
+when creating a rolling boulder trap, don't place boulder on a path that
+       starts on or passes over a pit/spiked pit, hole/trap door,
+       teleport trap/level teleporter/magic portal
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 8d08143b2eca5b74fefa7f70b3a00d2caf405bf6..59cb01f948ecafa5dcba141674c94f96b8a3d492 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 trap.h  $NHDT-Date: 1596498566 2020/08/03 23:49:26 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.19 $ */
+/* NetHack 3.7 trap.h  $NHDT-Date: 1615759956 2021/03/14 22:12:36 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.20 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Pasi Kallinen, 2016. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -84,5 +84,7 @@ enum trap_types {
 
 #define is_pit(ttyp) ((ttyp) == PIT || (ttyp) == SPIKED_PIT)
 #define is_hole(ttyp)  ((ttyp) == HOLE || (ttyp) == TRAPDOOR)
+/* "transportation" traps */
+#define is_xport(ttyp) ((ttyp) >= TELEP_TRAP && (ttyp) <= MAGIC_PORTAL)
 
 #endif /* TRAP_H */
index d3718cad03ab8d91a3349877febef3b62f85e19f..1a7917b57984e5a04c221515ddbda89a5c428631 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 trap.c  $NHDT-Date: 1612053752 2021/01/31 00:42:32 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.402 $ */
+/* NetHack 3.7 trap.c  $NHDT-Date: 1615759958 2021/03/14 22:12:38 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.403 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2996,6 +2996,7 @@ isclearpath(
     schar dx,
     schar dy)
 {
+    struct trap *t;
     uchar typ;
     xchar x, y;
 
@@ -3007,6 +3008,9 @@ isclearpath(
         typ = levl[x][y].typ;
         if (!isok(x, y) || !ZAP_POS(typ) || closed_door(x, y))
             return FALSE;
+        if ((t = t_at(x, y)) != 0
+            && (is_pit(t->ttyp) || is_hole(t->ttyp) || is_xport(t->ttyp)))
+            return FALSE;
     }
     cc->x = x;
     cc->y = y;