From: PatR Date: Fri, 18 Dec 2020 23:46:13 +0000 (-0800) Subject: displacing pets into water X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9535a84f1d8bfe64ed9bd65065d05dd93a355f7;p=nethack displacing pets into water 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. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 2b498f61e..9b619329b 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -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 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 diff --git a/src/hack.c b/src/hack.c index c8c30d900..5fbc39741 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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))) {