chameleon/genocide fix (trunk only)
While testing some pending teleport changes, I was baffled by having
my adjacent pet sometimes vanish when accompanying me on a level teleport.
Tracing through parts of execution: keepdogs() kept it; losedogs() called
mon_arrive() which called place_monster() for it, but then right after that
kill_genocided_monsters() removed it. Turns out that `kill_cham' was left
uninitialized for the first iteration through the fmon loop (and pet had
always just been inserted as first entry of the fmon list).
No fixes entry; this revises a post-3.4.3 revision.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)mon.c 3.5 2005/07/13 */
|
/* SCCS Id: @(#)mon.c 3.5 2006/03/24 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -2764,17 +2764,17 @@ kill_genocided_monsters()
|
|||||||
* 2) otherwise, force every chameleon which is imitating
|
* 2) otherwise, force every chameleon which is imitating
|
||||||
* any genocided species to take on a new form.
|
* any genocided species to take on a new form.
|
||||||
*/
|
*/
|
||||||
for (mtmp = fmon; mtmp; mtmp = mtmp2, kill_cham = FALSE) {
|
for (mtmp = fmon; mtmp; mtmp = mtmp2) {
|
||||||
mtmp2 = mtmp->nmon;
|
mtmp2 = mtmp->nmon;
|
||||||
if (DEADMONSTER(mtmp)) continue;
|
if (DEADMONSTER(mtmp)) continue;
|
||||||
mndx = monsndx(mtmp->data);
|
mndx = monsndx(mtmp->data);
|
||||||
if (mtmp->cham >= LOW_PM && (mvitals[mtmp->cham].mvflags & G_GENOD))
|
kill_cham = (mtmp->cham >= LOW_PM &&
|
||||||
kill_cham = TRUE;
|
(mvitals[mtmp->cham].mvflags & G_GENOD));
|
||||||
if ((mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
|
if ((mvitals[mndx].mvflags & G_GENOD) || kill_cham) {
|
||||||
if (mtmp->cham >= LOW_PM && !kill_cham)
|
if (mtmp->cham >= LOW_PM && !kill_cham)
|
||||||
(void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
|
(void) newcham(mtmp, (struct permonst *)0, FALSE, FALSE);
|
||||||
else
|
else
|
||||||
mondead(mtmp);
|
mondead(mtmp);
|
||||||
}
|
}
|
||||||
if (mtmp->minvent) kill_eggs(mtmp->minvent);
|
if (mtmp->minvent) kill_eggs(mtmp->minvent);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user