From 8551df2a7ac2a0117b82eecf73b462bd713eea54 Mon Sep 17 00:00:00 2001 From: PatR Date: Fri, 9 Nov 2018 15:43:50 -0800 Subject: [PATCH] impossible worm_cross non-adjacent location Attempting to mount a long worm tail could yield \#ride -> mount_steed() -> test_move() -> worm_cross() -> impossible("worm_cross checking for non-adjacent location"). --- doc/fixes36.2 | 2 ++ src/steed.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index fe1b5736f..47452ff97 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -187,6 +187,8 @@ add missing 'A - autoselect all' choice for menustyle:Full when taking items out while looting a container fix odd wording "The boulder triggers and fills a pit" ^X status feedback: don't report "not wearing any armor" when wearing a shield +attempting to #ride a long worm's tail could trigger impossible "worm_cross + checking for non-adjacent location?" Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/steed.c b/src/steed.c index 1abdb867c..8cbf9d0ef 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 steed.c $NHDT-Date: 1445906867 2015/10/27 00:47:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.47 $ */ +/* NetHack 3.6 steed.c $NHDT-Date: 1541806894 2018/11/09 23:41:34 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.54 $ */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -243,6 +243,16 @@ boolean force; /* Quietly force this animal */ pline("I see nobody there."); return (FALSE); } + if (mtmp->data == &mons[PM_LONG_WORM] + && (u.ux + u.dx != mtmp->mx || u.uy + u.dy != mtmp->my)) { + /* 3.6.2: test_move(below) is used to check for trying to mount + diagonally into or out of a doorway or through a tight squeeze; + attempting to mount a tail segment when hero was not adjacent + to worm's head could trigger an impossible() in worm_cross() + called from test_move(), so handle not-on-head before that */ + You("couldn't ride %s, let alone its tail.", a_monnam(mtmp)); + return FALSE; + } if (u.uswallow || u.ustuck || u.utrap || Punished || !test_move(u.ux, u.uy, mtmp->mx - u.ux, mtmp->my - u.uy, TEST_MOVE)) {