From 8fa38ec8fb2b9c26cc3b95c46ae7748f60f14540 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 4 Oct 2019 15:16:51 -0700 Subject: [PATCH] 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. --- doc/fixes36.3 | 9 +++++++-- src/teleport.c | 13 +++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doc/fixes36.3 b/doc/fixes36.3 index 4c3bd945e..ea0ebba13 100644 --- a/doc/fixes36.3 +++ b/doc/fixes36.3 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.121 $ $NHDT-Date: 1570142734 2019/10/03 22:45:34 $ +$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.122 $ $NHDT-Date: 1570227405 2019/10/04 22:16:45 $ This fixes36.3 file is here to capture information about updates in the 3.6.x lineage following the release of 3.6.2 in May 2019. Please note, however, @@ -163,6 +163,11 @@ query_category() and whatdoes_help() had early returns which could each leave the query one couldn't happen unless there is a coding error for object classes somewhere and the help one couldn't happen unless the installed data files left 'keyhelp' missing] +ball and chain could end up too far from punished hero (triggering b&c warning + for wizard mode with sanity checking active) when crawling out of + water failed because dropping stuff left hero overly encumbered and + hero was life saved--or player declined to die--if the hero got + teleported one step further from ball and chain's current location Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository @@ -170,7 +175,7 @@ Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository elemental_clog() loop needed to guard against obliteration of the monster that was trying to be placed using ^G to create "hidden mimic" shouldn't have marked it as undetected since - mimics 'hide' be appearing to be something else; honor "hidden" for + mimics 'hide' by appearing to be something else; honor "hidden" for 'hides_under' creatures if/when created at location with object(s), also for eels and other fish if/when created at water location for wizard mode 'wizweight' option, glob weight wasn't shown unless glob had diff --git a/src/teleport.c b/src/teleport.c index 9c2bd66f5..1e51ab1be 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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