diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-23 20:32:37 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-23 20:32:37 +0000 |
commit | 6f00e679d1f90041599c50c3cc86ab4e499c9ba1 (patch) | |
tree | 2e1ceeed3d328f639166d0ca53dddbd6fba6cdcf /crawl-ref/source/files.cc | |
parent | 0b1e914465f3e3f1f4c73f63cf2346c3f2253861 (diff) | |
download | crawl-ref-6f00e679d1f90041599c50c3cc86ab4e499c9ba1.tar.gz crawl-ref-6f00e679d1f90041599c50c3cc86ab4e499c9ba1.zip |
More cleanups and fixes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6648 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r-- | crawl-ref/source/files.cc | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 3a25835dde..f0f7c041c2 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -977,25 +977,22 @@ static bool _grab_follower_at(const coord_def &pos) 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++) - { - if (i == you.x_pos && j == you.y_pos) - continue; - if (mgrd[i][j] == NON_MONSTER) - continue; + // Handle nearby ghosts. + for ( adjacent_iterator ai; ai; ++ai ) + { + if (mgrd(*ai) == NON_MONSTER) + continue; - monsters *fmenv = &menv[mgrd[i][j]]; + monsters *fmenv = &menv[mgrd(*ai)]; - if (fmenv->type == MONS_PLAYER_GHOST - && fmenv->hit_points < fmenv->max_hit_points / 2) - { - mpr("The ghost fades into the shadows."); - monster_teleport(fmenv, true); - continue; - } + if (fmenv->type == MONS_PLAYER_GHOST + && fmenv->hit_points < fmenv->max_hit_points / 2) + { + mpr("The ghost fades into the shadows."); + monster_teleport(fmenv, true); } + } if (can_follow) { @@ -1218,8 +1215,8 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, crawl_view.set_player_at(you.pos(), load_mode != LOAD_VISITOR); // This should fix the "monster occurring under the player" bug? - if (make_changes && mgrd[you.x_pos][you.y_pos] != NON_MONSTER) - monster_teleport(&menv[mgrd[you.x_pos][you.y_pos]], true, true); + if (make_changes && mgrd(you.pos()) != NON_MONSTER) + monster_teleport(&menv[mgrd(you.pos())], true, true); // Actually "move" the followers if applicable. if (level_type_allows_followers(you.level_type) |