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").
This commit is contained in:
PatR
2018-11-09 15:43:50 -08:00
parent 91f973306b
commit 8551df2a7a
2 changed files with 13 additions and 1 deletions

View File

@@ -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

View File

@@ -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)) {