summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/files.cc20
-rw-r--r--crawl-ref/source/misc.cc2
-rw-r--r--crawl-ref/source/place.cc5
-rw-r--r--crawl-ref/source/place.h1
4 files changed, 18 insertions, 10 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index b428ea85b1..2e69a145c1 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -777,13 +777,9 @@ static void clear_clouds()
env.cgrid.init(EMPTY_CLOUD);
}
-static bool level_type_allows_followers(level_area_type type)
-{
- return (type == LEVEL_DUNGEON || type == LEVEL_PANDEMONIUM);
-}
-
static void grab_followers()
{
+ const bool can_follow = level_type_allows_followers(you.level_type);
for (int i = you.x_pos - 1; i < you.x_pos + 2; i++)
{
for (int j = you.y_pos - 1; j < you.y_pos + 2; j++)
@@ -808,11 +804,18 @@ static void grab_followers()
if (!testbits( fmenv->flags, MF_TAKING_STAIRS ))
continue;
+ if (!can_follow)
+ {
+ // Monster can't follow us, so clear the follower flag.
+ fmenv->flags &= ~MF_TAKING_STAIRS;
+ continue;
+ }
+
#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "%s is following.",
- fmenv->name(DESC_CAP_THE, true).c_str());
+ mprf(MSGCH_DIAGNOSTICS, "%s is following to %s.",
+ fmenv->name(DESC_CAP_THE, true).c_str(),
+ level_id::current().describe().c_str());
#endif
-
fmenv->set_transit(level_id::current());
fmenv->destroy_inventory();
monster_cleanup(fmenv);
@@ -865,7 +868,6 @@ bool load( dungeon_feature_type stair_taken, int load_mode,
{
grab_followers();
-
if (old_level_type == LEVEL_DUNGEON)
save_level( old_level, LEVEL_DUNGEON, where_were_you2 );
}
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 92d886787a..5ad6c4a742 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -463,7 +463,7 @@ static void leaving_level_now()
dungeon_events.fire_position_event(DET_PLAYER_CLIMBS, you.pos());
dungeon_events.fire_event(DET_LEAVING_LEVEL);
- you.level_type_name = newtype;
+ you.level_type_name = newtype;
}
void up_stairs(dungeon_feature_type force_stair)
diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc
index e4fe0235ac..0bc2fc8a60 100644
--- a/crawl-ref/source/place.cc
+++ b/crawl-ref/source/place.cc
@@ -172,3 +172,8 @@ bool level_type_exits_down(level_area_type type)
{
return (type == LEVEL_PANDEMONIUM || type == LEVEL_ABYSS);
}
+
+bool level_type_allows_followers(level_area_type type)
+{
+ return (type == LEVEL_DUNGEON || type == LEVEL_PANDEMONIUM);
+}
diff --git a/crawl-ref/source/place.h b/crawl-ref/source/place.h
index c3a0d82704..b2bbc0f2b9 100644
--- a/crawl-ref/source/place.h
+++ b/crawl-ref/source/place.h
@@ -49,5 +49,6 @@ bool single_level_branch(branch_type branch);
bool level_type_exits_up(level_area_type type);
bool level_type_exits_down(level_area_type type);
+bool level_type_allows_followers(level_area_type type);
#endif