summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/abyss.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-05 21:06:18 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-05 21:08:56 +0100
commitfcf5eff77ab0d0ae01b622cbb82d694e46b4cf48 (patch)
treeb9092647c1dcb982a8be1d5787c8c83412725787 /crawl-ref/source/abyss.cc
parent397eda1b80841f7c1ae6396a3db434410892722f (diff)
downloadcrawl-ref-fcf5eff77ab0d0ae01b622cbb82d694e46b4cf48.tar.gz
crawl-ref-fcf5eff77ab0d0ae01b622cbb82d694e46b4cf48.zip
Fix a monster-in-a-wall crash on banishment.
When a mockup of your current pre-banishment surroundings is written into the abyss, regular monster generation hasn't happened yet, but banished and/or left from a previous visit monsters are already there. Thus, we need to displace them if needed.
Diffstat (limited to 'crawl-ref/source/abyss.cc')
-rw-r--r--crawl-ref/source/abyss.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index f7c63c60b0..d5a6efec4f 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -72,6 +72,7 @@ static list<monster*> displaced_monsters;
static void abyss_area_shift(void);
static void _push_items(void);
+static void _push_displaced_monster(monster* mon);
// If not_seen is true, don't place the feature where it can be seen from
// the centre. Returns the chosen location, or INVALID_COORD if it
@@ -123,6 +124,7 @@ static void _write_abyssal_features()
if (abyssal_features.empty())
return;
+ dprf(DIAG_ABYSS, "Writing a mock-up of old level.");
const int count = abyssal_features.size();
ASSERT(count == 213);
const int scalar = 0xFF;
@@ -146,6 +148,8 @@ static void _write_abyssal_features()
{
grd(p) = abyssal_features[index];
env.level_map_mask(p) = MMT_VAULT;
+ if (monster* mon = monster_at(p))
+ _push_displaced_monster(mon);
}
}
else
@@ -1529,6 +1533,7 @@ retry:
_abyss_apply_terrain(abyss_genlevel_mask);
grd(you.pos()) = _veto_dangerous_terrain(grd(you.pos()));
+ _place_displaced_monsters();
for (rectangle_iterator ri(MAPGEN_BORDER); ri; ++ri)
ASSERT(grd(*ri) > DNGN_UNSEEN);