fix 'b&c distance' sanity check warning
when attempting to crawl out of water fails and hero is life-saved or wizard-/explore-mode player declines to die. If the hero is saved by positioning him/her one step further away from ball and chain, teleds() tries to drag them, but if 'emergency disrobe' left the hero stressed or worse, dragging fails. Ball and chain were being left where they were, with chain no longer being adjacent to hero. If drag_ball() fails, have teleds() teleport ball and chain to hero's new spot, same as when that isn't within range of a one step drag.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 teleport.c $NHDT-Date: 1564771880 2019/08/02 18:51:20 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */
|
||||
/* NetHack 3.6 teleport.c $NHDT-Date: 1570227405 2019/10/04 22:16:45 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.93 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -305,9 +305,9 @@ boolean allow_drag;
|
||||
* rock in the way), in which case it teleports the ball on its own.
|
||||
*/
|
||||
if (ball_active) {
|
||||
if (!carried(uball) && distmin(nux, nuy, uball->ox, uball->oy) <= 2)
|
||||
if (!carried(uball) && distmin(nux, nuy, uball->ox, uball->oy) <= 2) {
|
||||
ball_still_in_range = TRUE; /* don't have to move the ball */
|
||||
else {
|
||||
} else {
|
||||
/* have to move the ball */
|
||||
if (!allow_drag || distmin(u.ux, u.uy, nux, nuy) > 1) {
|
||||
/* we should not have dist > 1 and allow_drag at the same
|
||||
@@ -344,8 +344,13 @@ boolean allow_drag;
|
||||
boolean cause_delay;
|
||||
|
||||
if (drag_ball(nux, nuy, &bc_control, &ballx, &bally, &chainx,
|
||||
&chainy, &cause_delay, allow_drag))
|
||||
&chainy, &cause_delay, allow_drag)) {
|
||||
move_bc(0, bc_control, ballx, bally, chainx, chainy);
|
||||
} else {
|
||||
/* dragging fails if hero is encumbered beyond 'burdened' */
|
||||
allow_drag = FALSE; /* teleport b&c to hero's new spot */
|
||||
unplacebc(); /* to match placebc() below */
|
||||
}
|
||||
}
|
||||
}
|
||||
/* must set u.ux, u.uy after drag_ball(), which may need to know
|
||||
|
||||
Reference in New Issue
Block a user