fix pull request #379 - is_displacer()

A couple of places which could/should have been using existing
is_displacer() macro weren't.

No change in behavior.

Fixes #379
This commit is contained in:
PatR
2020-08-27 17:38:11 -07:00
parent 3f81bd5af6
commit 1df2fdca44
2 changed files with 4 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 do.c $NHDT-Date: 1596498158 2020/08/03 23:42:38 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.247 $ */ /* NetHack 3.7 do.c $NHDT-Date: 1598575088 2020/08/28 00:38:08 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.248 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1944,7 +1944,7 @@ long timeout UNUSED;
/* corpse will revive somewhere else if there is a monster in the way; /* corpse will revive somewhere else if there is a monster in the way;
Riders get a chance to try to bump the obstacle out of their way */ Riders get a chance to try to bump the obstacle out of their way */
if ((mptr->mflags3 & M3_DISPLACES) != 0 && body->where == OBJ_FLOOR if (is_displacer(mptr) && body->where == OBJ_FLOOR
&& get_obj_location(body, &x, &y, 0) && (mtmp = m_at(x, y)) != 0) { && get_obj_location(body, &x, &y, 0) && (mtmp = m_at(x, y)) != 0) {
boolean notice_it = canseemon(mtmp); /* before rloc() */ boolean notice_it = canseemon(mtmp); /* before rloc() */
char *monname = Monnam(mtmp); char *monname = Monnam(mtmp);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mon.c $NHDT-Date: 1596498185 2020/08/03 23:43:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.343 $ */ /* NetHack 3.7 mon.c $NHDT-Date: 1598575089 2020/08/28 00:38:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */ /*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1742,8 +1742,7 @@ struct monst *magr, /* monster that is currently deciding where to move */
as high as the attacker, don't let attacker do so, otherwise as high as the attacker, don't let attacker do so, otherwise
they might just end up swapping places again when defender they might just end up swapping places again when defender
gets its chance to move */ gets its chance to move */
if ((pa->mflags3 & M3_DISPLACES) != 0 if (is_displacer(pa) && (!is_displacer(pd) || magr->m_lev > mdef->m_lev)
&& ((pd->mflags3 & M3_DISPLACES) == 0 || magr->m_lev > mdef->m_lev)
/* no displacing grid bugs diagonally */ /* no displacing grid bugs diagonally */
&& !(magr->mx != mdef->mx && magr->my != mdef->my && !(magr->mx != mdef->mx && magr->my != mdef->my
&& NODIAG(monsndx(pd))) && NODIAG(monsndx(pd)))