]> granicus.if.org Git - nethack/commitdiff
Use could_reach_item
authorPasi Kallinen <paxed@alt.org>
Tue, 31 Jan 2023 17:09:43 +0000 (19:09 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 31 Jan 2023 17:09:43 +0000 (19:09 +0200)
include/extern.h
src/dogmove.c
src/monmove.c

index 6e7e44fd2ef0aecd17be077e74c4da2c8b4e8f03..33c8da31adf069032dd28f6e23e4bec610dc9b43 100644 (file)
@@ -620,6 +620,7 @@ extern struct obj *droppables(struct monst *);
 extern int dog_nutrition(struct monst *, struct obj *);
 extern int dog_eat(struct monst *, struct obj *, coordxy, coordxy, boolean);
 extern int dog_move(struct monst *, int);
+extern boolean could_reach_item(struct monst *, coordxy, coordxy);
 extern void finish_meating(struct monst *);
 extern void quickmimic(struct monst *);
 
index cdb19c9a8989da4f47c0853ced8b4a22aa9b163f..06fe85388535fc8a9b0144878c73d9b387518ac4 100644 (file)
@@ -22,7 +22,6 @@ static int pet_ranged_attk(struct monst *);
 static long score_targ(struct monst *, struct monst *);
 static boolean can_reach_location(struct monst *, coordxy, coordxy, coordxy,
                                   coordxy);
-static boolean could_reach_item(struct monst *, coordxy, coordxy);
 
 /* pick a carried item for pet to drop */
 struct obj *
@@ -1290,7 +1289,7 @@ dog_move(register struct monst *mtmp,
 }
 
 /* check if a monster could pick up objects from a location */
-static boolean
+boolean
 could_reach_item(struct monst *mon, coordxy nx, coordxy ny)
 {
     if ((!is_pool(nx, ny) || is_swimmer(mon->data))
index c0f71b7cc78ff4af079457c3c9e057a6b2e909e6..c12407ba782531e3032e42e1c523faeb055e9a42 100644 (file)
@@ -1319,8 +1319,7 @@ m_move(register struct monst* mtmp, register int after)
                        water location accepts flyers, but they can't reach
                        underwater objects, so being able to move to a spot
                        is insufficient for deciding whether to do so */
-                    if ((is_pool(xx, yy) && !is_swimmer(ptr))
-                        || (is_lava(xx, yy) && !likes_lava(ptr)))
+                    if (!could_reach_item(mtmp, xx, yy))
                         continue;
 
                     /* ignore obj if there's a trap and monster knows it */