summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 17:37:56 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-01 17:37:56 +0000
commit11c08abe629362a45f0276212dfcd5ca2069b9b8 (patch)
tree94d78cb7d876adab5c7a46ee540694dfdb78c2d7 /crawl-ref/source/monstuff.cc
parent127bc45cca50bbfc9112612b54969c7b889145cb (diff)
downloadcrawl-ref-11c08abe629362a45f0276212dfcd5ca2069b9b8.tar.gz
crawl-ref-11c08abe629362a45f0276212dfcd5ca2069b9b8.zip
The royal jelly's death triggers wall change even if it is off-level. Also fixed being able to lose the royal jelly when banishing it and crash when killing the royal jelly in the Abyss.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4030 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc46
1 files changed, 41 insertions, 5 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index bbdb9b8dcd..2ff479c020 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -640,11 +640,41 @@ static bool _is_mons_mutator_or_rotter(monsters *mons)
return (attk_flavour == AF_MUTATE || attk_flavour == AF_ROT);
}
-static bool _slime_pit_enable_teleport_control()
+static bool _slime_pit_unlock(bool silent)
{
- return unset_level_flags(LFLAG_NO_TELE_CONTROL);
+ unset_level_flags(LFLAG_NO_TELE_CONTROL, silent);
+
+ bool in_los = false;
+ if (!silent)
+ {
+ for (int x = 0; x < GXM && !in_los; ++x)
+ for (int y = 0; y < GYM; ++y)
+ if (grd[x][y] == DNGN_STONE_WALL
+ && see_grid(x, y))
+ {
+ in_los = true;
+ break;
+ }
+ }
+
+ replace_area_wrapper(DNGN_STONE_WALL, DNGN_CLEAR_ROCK_WALL);
+
+ if (!silent)
+ {
+ if (in_los)
+ mpr("Suddenly, all colour oozes out of the stone walls.",
+ MSGCH_MONSTER_ENCHANT);
+ else
+ mpr("You feel a strange vibration for a moment.",
+ MSGCH_MONSTER_ENCHANT);
+ }
+
+ return (true);
}
+static bool _slime_pit_unlock_offlevel() { return _slime_pit_unlock(true); }
+static bool _slime_pit_unlock_onlevel() { return _slime_pit_unlock(false); }
+
static void _fire_monster_death_event(monsters *monster,
killer_type killer,
int i)
@@ -658,9 +688,15 @@ static void _fire_monster_death_event(monsters *monster,
monster_index(monster), killer));
if (monster->type == MONS_ROYAL_JELLY)
- apply_to_level( level_id(BRANCH_SLIME_PITS, 6),
- true,
- _slime_pit_enable_teleport_control );
+ {
+ const level_id target(BRANCH_SLIME_PITS, 6);
+ if (is_existing_level(target))
+ apply_to_level(
+ target,
+ true,
+ target == level_id::current()?
+ _slime_pit_unlock_onlevel : _slime_pit_unlock_offlevel );
+ }
}
}