refine a dog_eat impossible()

Have the impossible message indicate whether the pointed-to
edog struct itself is still intact (not overwritten somewhere,
such as misuse of a stale or bad pointer) versus the apport field
itself being assigned an out-of-whack value some place.
This commit is contained in:
nhmall
2026-04-11 06:37:10 -04:00
parent b264e17cf2
commit 85f03deca9

View File

@@ -316,9 +316,13 @@ dog_eat(struct monst *mtmp,
edog->apport += (int) (200L / ((long) edog->dropdist + svm.moves
- edog->droptime));
if (edog->apport <= 0) {
impossible("dog_eat: pet apport <= 0 (%d, %d, %ld, %ld)",
impossible("dog_eat: pet apport <= 0 (%d, %d, %ld, %ld, %ud, %ud)",
edog->apport, edog->dropdist, edog->droptime,
svm.moves);
svm.moves,
/* check whether edog struct got clobbered;
these two values should always match if
edog content is still intact */
mtmp->m_id, edog->parentmid);
edog->apport = 1;
}
}