From 6df83cb67790093b9eaaccfbeff0d5a47e9098d2 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 17 Jan 2025 17:07:04 +0200 Subject: [PATCH] Fix pet data being reset when charm monster was cast Casting charm monster with pets nearby could reset the edog struct. If the pet ate a mimic corpse and was pretending to be something else when that edog reset happened, the sanity checking would issue an impossible. The error happened because meating was reset, but the pet appearance was not, but the edog struct reset is the part being wrong. Lets not do that. To reproduce, turn on sanity checking, create a tame dog, give it a mimic corpse to eat, #wizcast charm monster next to it. --- src/dog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dog.c b/src/dog.c index 4b523db7c..38bd92fd9 100644 --- a/src/dog.c +++ b/src/dog.c @@ -1208,8 +1208,10 @@ tamedog( return FALSE; /* add the pet extension */ - newedog(mtmp); - initedog(mtmp); + if (!has_edog(mtmp)) { + newedog(mtmp); + initedog(mtmp); + } if (obj) { /* thrown food */ /* defer eating until the edog extension has been set up */