]> granicus.if.org Git - nethack/commitdiff
Use grounded macro
authorPasi Kallinen <paxed@alt.org>
Tue, 15 Feb 2022 16:44:56 +0000 (18:44 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 15 Feb 2022 16:44:56 +0000 (18:44 +0200)
src/dig.c
src/hack.c
src/mon.c
src/steed.c
src/teleport.c
src/trap.c

index d96eeb944ce672bca492e350cfd34ca91f6e5933..aabc43831bdf7c794ca22100f21fac031bea2257 100644 (file)
--- 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;
index cb9a84df2f0619fcb6c5df867da22c9c00d461a2..4ccf8d0a12d0084f59f99206f365cf46b90e60af 100644 (file)
@@ -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;
index 0e705a9b401ffc8923f3eae1d5f458ce79bab3d4..11c0e833cde56cfc38ed5286ba5d3f007e269eca 100644 (file)
--- 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);
index 94d35bc84059ece14c7cf6b01270bad34ecbfd93..976d630875aef8eb65d0cedba2b90630f476799c 100644 (file)
@@ -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),
index a9bd26f3587579b5d4d6c32f0748fc9011f4f52e..0aa28a82b96d10bc2ecdf607128fa8775a045543 100644 (file)
@@ -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)) {
index 2d96ff04418f14e2b15cde4f28e79e74c0f0d546..5e53581a344f979756a3d8b678d3e7b6a54b07d8 100644 (file)
@@ -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 */