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.
This commit is contained in:
PatR
2020-12-18 15:46:13 -08:00
parent c709c45780
commit b9535a84f1
2 changed files with 7 additions and 7 deletions

View 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 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 monster movement flags unification allowed displacer beasts to displace Riders
a long worm with no visible segments (but one internal segment) might trigger 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 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 curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support also included tty support

View 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) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* 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 */ /* can't swap places when pet won't fit thru the opening */
You("stop. %s won't fit through.", upstart(y_monnam(mtmp))); You("stop. %s won't fit through.", upstart(y_monnam(mtmp)));
didnt_move = TRUE; didnt_move = TRUE;
} else if ((mtmp->mpeaceful || mtmp->mtame) && mtmp->mtrapped) { } else if (mtmp->mpeaceful && mtmp->mtrapped) {
/* Since peaceful monsters simply being unable to move out of traps /* all mtame are also mpeaceful, so this affects pets too */
* was inconsistent with pets being able to but being untamed in
* the process, apply this logic equally to pets and peacefuls. */
You("stop. %s can't move out of that trap.", You("stop. %s can't move out of that trap.",
upstart(y_monnam(mtmp))); upstart(y_monnam(mtmp)));
didnt_move = TRUE; didnt_move = TRUE;
} else if (mtmp->mpeaceful && !mtmp->mtame } else if (mtmp->mpeaceful
&& (!goodpos(u.ux0, u.uy0, mtmp, 0) && (!goodpos(u.ux0, u.uy0, mtmp, 0)
|| t_at(u.ux0, u.uy0) != NULL || t_at(u.ux0, u.uy0) != NULL
|| mundisplaceable(mtmp))) { || mundisplaceable(mtmp))) {