summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monster.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-06-22 16:57:57 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-06-22 16:59:12 -0700
commitc76c7bb6881a3b5127f762cadb91379564033b49 (patch)
tree4b2cbdd642875675757e896bbd014262675c319a /crawl-ref/source/monster.cc
parent3dc87739768dc6fa52fe3f348614188964a58dc6 (diff)
downloadcrawl-ref-c76c7bb6881a3b5127f762cadb91379564033b49.tar.gz
crawl-ref-c76c7bb6881a3b5127f762cadb91379564033b49.zip
Fix a crash when recalling monsters onto shafts (8717)
Also removes a layer of indentation from recall_offlevel_ally(); apologies for the messy diff!
Diffstat (limited to 'crawl-ref/source/monster.cc')
-rw-r--r--crawl-ref/source/monster.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index ad02057556..dd8e64fccf 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -4711,10 +4711,9 @@ bool monster::find_home_near_place(const coord_def &c)
q.pop();
if (dist(p - c) >= last_dist && nvalid)
{
- // already found a valid closer destination
- if (!move_to_pos(place))
- return false;
- apply_location_effects(place);
+ ASSERT(move_to_pos(place));
+ // can't apply location effects here, since the monster might not
+ // be on the level yet, which interacts poorly with e.g. shafts
return true;
}
else if (dist(p - c) >= MAX_PLACE_NEAR_DIST)
@@ -4749,9 +4748,9 @@ bool monster::find_home_anywhere()
for (int tries = 0; tries < 600; ++tries)
if (check_set_valid_home(random_in_bounds(), place, nvalid))
{
- if (!move_to_pos(place))
- return false;
- apply_location_effects(place);
+ ASSERT(move_to_pos(place));
+ // can't apply location effects here, since the monster might not
+ // be on the level yet, which interacts poorly with e.g. shafts
return true;
}
return false;