From f10cdc2d9c8004d30e96fed9760873f4303c3989 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 26 Apr 2022 08:46:55 +0300 Subject: [PATCH] Use get_mleash to find the leash attached to monster --- src/apply.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/apply.c b/src/apply.c index e52c10133..fd8399ed1 100644 --- a/src/apply.c +++ b/src/apply.c @@ -565,12 +565,10 @@ m_unleash(struct monst *mtmp, boolean feedback) else Your("leash falls slack."); } - for (otmp = g.invent; otmp; otmp = otmp->nobj) - if (otmp->otyp == LEASH && (unsigned) otmp->leashmon == mtmp->m_id) { - otmp->leashmon = 0; - update_inventory(); - break; - } + if ((otmp = get_mleash(mtmp)) != 0) { + otmp->leashmon = 0; + update_inventory(); + } mtmp->mleashed = 0; }