summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-18 00:34:22 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-18 00:34:22 +0000
commit6817824379462ee5a1aab8267eb437d2b543504e (patch)
treede5fdb811964e1ae9baa86f8d78f19dc99f26a28 /crawl-ref/source/player.cc
parentb5890e8e1fde868016e260b98170e00c67947601 (diff)
downloadcrawl-ref-6817824379462ee5a1aab8267eb437d2b543504e.tar.gz
crawl-ref-6817824379462ee5a1aab8267eb437d2b543504e.zip
Consolidate checks for the player's being undead or a demonspawn into
player_is_unholy(), a la mons_is_unholy(), and use it where possible. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8522 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 1c181b0223..e567735c3a 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -6342,11 +6342,8 @@ bool player::could_wield(const item_def &item, bool ignore_brand,
if (!ignore_brand)
{
- if (is_holy_item(item)
- && (you.is_undead || you.species == SP_DEMONSPAWN))
- {
+ if (player_is_unholy() && is_holy_item(item))
return (false);
- }
}
#if 0
@@ -6764,6 +6761,13 @@ mon_holy_type player::holiness() const
return (MH_NATURAL);
}
+bool player_is_unholy()
+{
+ const mon_holy_type holiness = you.holiness();
+
+ return (holiness == MH_UNDEAD || holiness == MH_DEMONIC);
+}
+
// Output active level of player mutation.
// Might be lower than real mutation for non-"Alive" Vampires.
int player_mutation_level(mutation_type mut)