fix #3120,#3122 - dwarf pass_wall without digging

I couldn't reproduce this so can't confirm that this fix works,
but inspection of the code reveals that something was missing
in the unified mon movement flags code.  I think what has been
happening is that a dwarf without a pick-axe might not bother
wielding that but movement behaved as if it had, then digging
decided it wasn't.
This commit is contained in:
PatR
2020-12-07 12:46:46 -08:00
parent 99980376b2
commit 87818188e1
3 changed files with 16 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.376 $ $NHDT-Date: 1607252278 2020/12/06 10:57:58 $
NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.377 $ $NHDT-Date: 1607373999 2020/12/07 20:46:39 $
General Fixes and Modified Features
-----------------------------------
@@ -411,6 +411,7 @@ options help ('? g') listed all boolean options, then repeated them among
the compound options; on OSX they showed a description of "(null)"
but for other sprintf implementations they might cause a crash
change name of #wizlevelflip to #wizfliplevel
dwarves could sometimes pass through walls without digging their way
curses: 'msg_window' option wasn't functional for curses unless the binary
also included tty support

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 dogmove.c $NHDT-Date: 1596498159 2020/08/03 23:42:39 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.91 $ */
/* NetHack 3.7 dogmove.c $NHDT-Date: 1607374000 2020/12/07 20:46:40 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.94 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1311,7 +1311,9 @@ xchar mx, my, fx, fy;
if (dist2(i, j, fx, fy) >= dist)
continue;
if (IS_ROCK(levl[i][j].typ) && !passes_walls(mon->data)
&& (!may_dig(i, j) || !tunnels(mon->data)))
&& (!may_dig(i, j) || !tunnels(mon->data)
/* tunnelling monsters can't do that on the rogue level */
|| Is_rogue_level(&u.uz)))
continue;
if (IS_DOOR(levl[i][j].typ)
&& (levl[i][j].doormask & (D_CLOSED | D_LOCKED)))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1606623308 2020/11/29 04:15:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.357 $ */
/* NetHack 3.7 mon.c $NHDT-Date: 1607374002 2020/12/07 20:46:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.359 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1551,6 +1551,14 @@ struct monst *mtmp;
boolean can_unlock = ((can_open && monhaskey(mtmp, TRUE))
|| mtmp->iswiz || is_rider(mtmp->data));
boolean doorbuster = is_giant(mtmp->data);
/* don't tunnel if on rogue level or if hostile and close enough
to prefer a weapon; same criteria as in m_move() */
boolean can_tunnel = (tunnels(mtmp->data) && !Is_rogue_level(&u.uz));
if (can_tunnel && needspick(mtmp->data)
&& ((!mtmp->mpeaceful || Conflict)
&& dist2(mtmp->mx, mtmp->my, mtmp->mux, mtmp->muy) <= 8))
can_tunnel = FALSE;
if (mtmp->mtame)
allowflags |= ALLOW_M | ALLOW_TRAPS | ALLOW_SANCT | ALLOW_SSM;
@@ -1568,8 +1576,7 @@ struct monst *mtmp;
allowflags |= (ALLOW_ROCK | ALLOW_WALL);
if (throws_rocks(mtmp->data))
allowflags |= ALLOW_ROCK;
if (tunnels(mtmp->data)
&& !Is_rogue_level(&u.uz)) /* same restriction as m_move() */
if (can_tunnel)
allowflags |= ALLOW_DIG;
if (doorbuster)
allowflags |= BUSTDOOR;