From d05d98b63eed3a41480b235c4c61669059016e7b Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 18 Jun 2009 22:16:44 +0000 Subject: Fix crashes when spore explosions kill the attacking monster. And we're at our 10.000 commit! o_O git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10000 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monstuff.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/monstuff.cc') diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 85ef6af6b2..60df56cedc 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -1239,12 +1239,12 @@ int monster_die(monsters *monster, killer_type killer, } const bool death_message = !silent && !did_death_message - && mons_near(monster) - && (player_monster_visible(monster) - || crawl_state.arena); + && mons_near(monster) + && (player_monster_visible(monster) + || crawl_state.arena); const bool created_friendly = testbits(monster->flags, MF_CREATED_FRIENDLY); - const bool anon = (killer_index == ANON_FRIENDLY_MONSTER); + bool anon = (killer_index == ANON_FRIENDLY_MONSTER); const mon_holy_type targ_holy = mons_holiness(monster); switch (killer) @@ -1444,6 +1444,11 @@ int monster_die(monsters *monster, killer_type killer, bool notice = false; monsters *killer_mon = &menv[killer_index]; + // If the killer is already dead treat it like an anonymous + // monster. + if (killer_mon->type == -1) + anon = true; + const mon_holy_type killer_holy = anon ? MH_NATURAL : mons_holiness(killer_mon); -- cgit v1.2.3-54-g00ecf