summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-28 15:26:28 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-28 15:26:28 +0000
commitc352a8d5a475e0bca449bfc0121e2065b848fdef (patch)
tree9dcc92d2d3e6d4488c056cb423e363defefb832b /crawl-ref
parent7287acae93b7a294674f5d30a165957c7c117d66 (diff)
downloadcrawl-ref-c352a8d5a475e0bca449bfc0121e2065b848fdef.tar.gz
crawl-ref-c352a8d5a475e0bca449bfc0121e2065b848fdef.zip
Simplify _mon_on_interesting_grid() by reusing _is_native_in_branch()
where possible. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5314 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/monstuff.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index bd820eb618..054264beed 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -82,6 +82,8 @@ static void _mons_in_cloud(monsters *monster);
static bool _monster_move(monsters *monster);
static bool _plant_spit(monsters *monster, bolt &pbolt);
static spell_type _map_wand_to_mspell(int wand_type);
+static bool _is_native_in_branch(const monsters *monster,
+ const branch_type branch);
// [dshaligram] Doesn't need to be extern.
static int mmov_x, mmov_y;
@@ -2829,24 +2831,23 @@ static bool _mon_on_interesting_grid(monsters *mon)
// else fall through
case DNGN_ALTAR_ZIN:
case DNGN_ALTAR_SHINING_ONE:
- return (mons_holiness(mon) == MH_HOLY);
+ return (mons_is_holy(mon));
// Orcs will tend to patrol around altars to Beogh, and guard the
// stairway from and to the Orcish Mines.
case DNGN_ALTAR_BEOGH:
case DNGN_ENTER_ORCISH_MINES:
case DNGN_RETURN_FROM_ORCISH_MINES:
- return (mons_species(mon->type) == MONS_ORC);
+ return (_is_native_in_branch(mon, BRANCH_ORCISH_MINES));
// Same for elves and the Elven Halls.
case DNGN_ENTER_ELVEN_HALLS:
case DNGN_RETURN_FROM_ELVEN_HALLS:
- return (mons_species(mon->type) == MONS_ELF);
+ return (_is_native_in_branch(mon, BRANCH_ELVEN_HALLS));
// Killer bees always return to their hive.
case DNGN_ENTER_HIVE:
- return (mons_species(mon->type == MONS_KILLER_BEE)
- || mons_species(mon->type == MONS_KILLER_BEE_LARVA));
+ return (_is_native_in_branch(mon, BRANCH_HIVE));
default:
return (false);
@@ -5742,9 +5743,9 @@ void mons_check_pool(monsters *mons, killer_type killer, int killnum)
}
}
-// Returns true for monsters that obviously (to the player)
-// feel "thematically at home" in a branch.
-// Currently used for native monsters recognizing traps.
+// Returns true for monsters that obviously (to the player) feel
+// "thematically at home" in a branch. Currently used for native
+// monsters recognizing traps and patrolling branch entrances.
static bool _is_native_in_branch(const monsters *monster,
const branch_type branch)
{