summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2009-11-07 18:10:51 -0500
committerCharles Otto <ottochar@gmail.com>2009-11-07 18:11:24 -0500
commit6b6ba7b163b1c716f419ec0cbcb12fbb96525888 (patch)
tree6a1a57e187f271b55f3225e419fea62639d849a8
parent1b6b5735d019d49a580693b30687bbf149ae5e59 (diff)
downloadcrawl-ref-6b6ba7b163b1c716f419ec0cbcb12fbb96525888.tar.gz
crawl-ref-6b6ba7b163b1c716f419ec0cbcb12fbb96525888.zip
Avoid an infinite loop in tilse related to Feawn neutralizing plants
Avoid an infinite loop caused caused by calling remove_auto_exclude on plants that get neutralized by Feawn. feawn_neutralise is called via viewwindow, and it was calling remove_auto_exclude, in tiles remove_auto_exclude calls viewwindow creating an infinite loop. Instead of calling remove_auto_exclude directly I added an attitude check to maybe_remove_autoexclusion which is (safely) called from viewwindow already.
-rw-r--r--crawl-ref/source/attitude-change.cc7
-rw-r--r--crawl-ref/source/exclude.cc5
2 files changed, 4 insertions, 8 deletions
diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc
index be4781a81c..342de10985 100644
--- a/crawl-ref/source/attitude-change.cc
+++ b/crawl-ref/source/attitude-change.cc
@@ -133,13 +133,6 @@ void feawn_neutralise(monsters* monster)
&& !testbits(monster->flags, MF_ATT_CHANGE_ATTEMPT)
&& !player_under_penance())
{
- // We must call remove_auto_exclude before neutralizing the
- // plant because remove_auto_exclude only removes exclusions
- // it thinks were caused by auto-exclude, and
- // auto-exclusions now check for ATT_HOSTILE. Oh, what a
- // tangled web, etc.
- remove_auto_exclude(monster, false);
-
feawn_neutralise_plant(monster);
monster->flags |= MF_ATT_CHANGE_ATTEMPT;
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 1c91a673d4..630d549d2b 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -328,8 +328,11 @@ void maybe_remove_autoexclusion(const coord_def &p)
if (travel_exclude *exc = _find_exclude_root(p))
{
const monsters *m = monster_at(p);
- if (exc->autoex && (!m || !you.can_see(m) || m->type != exc->mon))
+ if (exc->autoex && (!m || !you.can_see(m) || m->type != exc->mon
+ || m->attitude != ATT_HOSTILE))
+ {
del_exclude(p);
+ }
}
}