summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-speak.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-03-22 01:29:15 +0100
committerAdam Borowski <kilobyte@angband.pl>2012-03-22 01:59:37 +0100
commitf88c6a77a058a02aff74443da3fd9c371877fbf3 (patch)
treece7816ba5fada182e723c537820f4542a08049c4 /crawl-ref/source/mon-speak.cc
parentf22ecef8817a579eaba48747c8327f06424393bc (diff)
downloadcrawl-ref-f88c6a77a058a02aff74443da3fd9c371877fbf3.tar.gz
crawl-ref-f88c6a77a058a02aff74443da3fd9c371877fbf3.zip
Use actor->is_player() consistently instead of (actor->atype() == ACT_PLAYER).
Shorter and more readable. I did not change the similar comparison with ACT_MONSTER yet -- are we ever going to have other actor types? God acts may work as well with a fake monster, but multiplayer/arena can possibly want a third such type. On the other hand, code assumes that non-player implies monster and vice versa, though, so I'm probably worrying without a point.
Diffstat (limited to 'crawl-ref/source/mon-speak.cc')
-rw-r--r--crawl-ref/source/mon-speak.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc
index 130c8c13fd..d8ff7d99a0 100644
--- a/crawl-ref/source/mon-speak.cc
+++ b/crawl-ref/source/mon-speak.cc
@@ -474,7 +474,7 @@ bool mons_speaks(monster* mons)
&you : mons->get_foe();
const monster* m_foe = foe ? foe->as_monster() : NULL;
- if (!foe || foe->atype() == ACT_PLAYER || mons->wont_attack())
+ if (!foe || foe->is_player() || mons->wont_attack())
{
// Animals only look at the current player form, smart monsters at the
// actual player genus.
@@ -541,7 +541,7 @@ bool mons_speaks(monster* mons)
const bool no_foe = (foe == NULL);
const bool no_player = crawl_state.game_is_arena()
|| (!mons->wont_attack()
- && (!foe || foe->atype() != ACT_PLAYER));
+ && (!foe || !foe->is_player()));
const bool mon_foe = (m_foe != NULL);
const bool no_god = no_foe || (mon_foe && foe->deity() == GOD_NO_GOD);
const bool named_foe = !no_foe && (!mon_foe || (m_foe->is_named()