From: Pasi Kallinen Date: Tue, 15 Feb 2022 16:44:56 +0000 (+0200) Subject: Use grounded macro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e65c921ccb5881e5c48bf3e9dcbfe4e69a3719ac;p=nethack Use grounded macro --- diff --git a/src/dig.c b/src/dig.c index d96eeb944..aabc43831 100644 --- a/src/dig.c +++ b/src/dig.c @@ -695,8 +695,7 @@ digactualhole(int x, int y, struct monst *madeby, int ttyp) impact_drop((struct obj *) 0, x, y, 0); if (mtmp) { /*[don't we need special sokoban handling here?]*/ - if (is_flyer(mtmp->data) || is_floater(mtmp->data) - || mtmp->data == &mons[PM_WUMPUS] + if (!grounded(mtmp->data) || (mtmp->wormno && count_wsegs(mtmp) > 5) || mtmp->data->msize >= MZ_HUGE) return; diff --git a/src/hack.c b/src/hack.c index cb9a84df2..4ccf8d0a1 100644 --- a/src/hack.c +++ b/src/hack.c @@ -2436,9 +2436,7 @@ pooleffects(boolean newspot) /* true if called by spoteffects */ /* check for entering water or lava */ if (!u.ustuck && !Levitation && !Flying && is_pool_or_lava(u.ux, u.uy)) { - if (u.usteed - && (is_flyer(u.usteed->data) || is_floater(u.usteed->data) - || is_clinger(u.usteed->data))) { + if (u.usteed && !grounded(u.usteed->data)) { /* floating or clinging steed keeps hero safe (is_flyer() test is redundant; it can't be true since Flying yielded false) */ return FALSE; diff --git a/src/mon.c b/src/mon.c index 0e705a9b4..11c0e833c 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1780,12 +1780,11 @@ mfndpos( nodiag = NODIAG(mdat - mons); wantpool = (mdat->mlet == S_EEL); poolok = ((!Is_waterlevel(&u.uz) && !(nowtyp != WATER) - && (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat))) + && !grounded(mdat)) || (is_swimmer(mdat) && !wantpool)); /* note: floating eye is the only is_floater() so this could be simplified, but then adding another floater would be error prone */ - lavaok = (is_flyer(mdat) || is_floater(mdat) || is_clinger(mdat) - || likes_lava(mdat)); + lavaok = (!grounded(mdat) || likes_lava(mdat)); if (mdat == &mons[PM_FLOATING_EYE]) /* prefers to avoid heat */ lavaok = FALSE; thrudoor = ((flag & (ALLOW_WALL | BUSTDOOR)) != 0L); diff --git a/src/steed.c b/src/steed.c index 94d35bc84..976d63087 100644 --- a/src/steed.c +++ b/src/steed.c @@ -613,7 +613,7 @@ dismount_steed( struct permonst *mdat = mtmp->data; /* The steed may drop into water/lava */ - if (!is_flyer(mdat) && !is_floater(mdat) && !is_clinger(mdat)) { + if (grounded(mdat)) { if (is_pool(u.ux, u.uy)) { if (!Underwater) pline("%s falls into the %s!", Monnam(mtmp), diff --git a/src/teleport.c b/src/teleport.c index a9bd26f35..0aa28a82b 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -91,8 +91,7 @@ goodpos(int x, int y, struct monst* mtmp, long gpflags) return (is_swimmer(mdat) || (!Is_waterlevel(&u.uz) && !(levl[x][y].typ == WATER) - && (is_floater(mdat) || is_flyer(mdat) - || is_clinger(mdat)))); + && !grounded(mdat))); } else if (mdat->mlet == S_EEL && rn2(13) && !ignorewater) { return FALSE; } else if (is_lava(x, y)) { diff --git a/src/trap.c b/src/trap.c index 2d96ff044..5e53581a3 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1641,9 +1641,7 @@ trapeffect_pit( const char *fallverb; fallverb = "falls"; - if (is_flyer(mptr) || is_floater(mptr) - || (mtmp->wormno && count_wsegs(mtmp) > 5) - || is_clinger(mptr)) { + if (!grounded(mptr) || (mtmp->wormno && count_wsegs(mtmp) > 5)) { if (g.force_mintrap && !Sokoban) { /* openfallingtrap; not inescapable here */ if (in_sight) { @@ -1703,8 +1701,7 @@ trapeffect_hole( trapname(tt, TRUE)); return Trap_Effect_Finished; /* don't activate it after all */ } - if (is_flyer(mptr) || is_floater(mptr) || mptr == &mons[PM_WUMPUS] - || (mtmp->wormno && count_wsegs(mtmp) > 5) + if (!grounded(mptr) || (mtmp->wormno && count_wsegs(mtmp) > 5) || mptr->msize >= MZ_HUGE) { if (g.force_mintrap && !Sokoban) { /* openfallingtrap; not inescapable here */