]> granicus.if.org Git - nethack/commitdiff
Use find_mid finding the leashed mon
authorPasi Kallinen <paxed@alt.org>
Sat, 26 Feb 2022 20:42:37 +0000 (22:42 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 26 Feb 2022 20:42:37 +0000 (22:42 +0200)
src/apply.c

index 6ef88e89f590e92cd00dc80f2d6b2c891b33de04..9e8ef6bf1f673b9a20dfb45f7456d1eb5003c882 100644 (file)
@@ -760,12 +760,7 @@ check_leash(xchar x, xchar y)
     for (otmp = g.invent; otmp; otmp = otmp->nobj) {
         if (otmp->otyp != LEASH || otmp->leashmon == 0)
             continue;
-        for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
-            if (DEADMONSTER(mtmp))
-                continue;
-            if ((int) mtmp->m_id == otmp->leashmon)
-                break;
-        }
+        mtmp = find_mid(otmp->leashmon, FM_FMON);
         if (!mtmp) {
             impossible("leash in use isn't attached to anything?");
             otmp->leashmon = 0;