]> granicus.if.org Git - nethack/commitdiff
displacing pets into water
authorPatR <rankin@nethack.org>
Fri, 18 Dec 2020 23:46:13 +0000 (15:46 -0800)
committerPatR <rankin@nethack.org>
Fri, 18 Dec 2020 23:46:13 +0000 (15:46 -0800)
Don't let hero at water or lava location swap places with a
pet that can't survive there.  This was a regression to 3.4.3
behavior introduced when displacer beast monster was added.
I can't remember whether the regression was intentional at the
time, but guess not because I'm fairly sure that I would have
included a comment about it.

doc/fixes37.0
src/hack.c

index 2b498f61e62dabf4beeb174051bf22851221c50f..9b619329b052775e7ecb501906c1a9fcc935fec2 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.395 $ $NHDT-Date: 1608332750 2020/12/18 23:05:50 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.396 $ $NHDT-Date: 1608335163 2020/12/18 23:46:03 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -439,6 +439,8 @@ the checks and handling for fountains, sinks, and drawbridges were being
 monster movement flags unification allowed displacer beasts to displace Riders
 a long worm with no visible segments (but one internal segment) might trigger
        warning: tail 'segement' at <0,some_y>, worm at <mx,my> if teleported
+adding displacer beast inadvertently introduced a regression in swapping with
+       pets, allowing them to be pulled into water by hero on/over water
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index c8c30d900e7a6c34753ae8d131677df253ac1a01..5fbc397410df6844874ef79578f0ed0be4939483 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 hack.c  $NHDT-Date: 1605305491 2020/11/13 22:11:31 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.270 $ */
+/* NetHack 3.7 hack.c  $NHDT-Date: 1608335164 2020/12/18 23:46:04 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.273 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Derek S. Ray, 2015. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1889,14 +1889,12 @@ domove_core()
             /* can't swap places when pet won't fit thru the opening */
             You("stop.  %s won't fit through.", upstart(y_monnam(mtmp)));
             didnt_move = TRUE;
-        } else if ((mtmp->mpeaceful || mtmp->mtame) && mtmp->mtrapped) {
-            /* Since peaceful monsters simply being unable to move out of traps
-             * was inconsistent with pets being able to but being untamed in
-             * the process, apply this logic equally to pets and peacefuls. */
+        } else if (mtmp->mpeaceful && mtmp->mtrapped) {
+            /* all mtame are also mpeaceful, so this affects pets too */
             You("stop.  %s can't move out of that trap.",
                 upstart(y_monnam(mtmp)));
             didnt_move = TRUE;
-        } else if (mtmp->mpeaceful && !mtmp->mtame
+        } else if (mtmp->mpeaceful
                    && (!goodpos(u.ux0, u.uy0, mtmp, 0)
                        || t_at(u.ux0, u.uy0) != NULL
                        || mundisplaceable(mtmp))) {