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:
+6
-2
@@ -316,9 +316,13 @@ dog_eat(struct monst *mtmp,
|
|||||||
edog->apport += (int) (200L / ((long) edog->dropdist + svm.moves
|
edog->apport += (int) (200L / ((long) edog->dropdist + svm.moves
|
||||||
- edog->droptime));
|
- edog->droptime));
|
||||||
if (edog->apport <= 0) {
|
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,
|
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;
|
edog->apport = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user