summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-02 18:47:58 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-02 18:47:58 +0000
commit5a1d2984131beed046555602cee60045ac665212 (patch)
tree9eb4dae40b6f037581cc141e7351bce0ed49241b
parentab6f215b185b25b80ee169b13143a5bb73671b63 (diff)
downloadcrawl-ref-5a1d2984131beed046555602cee60045ac665212.tar.gz
crawl-ref-5a1d2984131beed046555602cee60045ac665212.zip
Simplify.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8127 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/mon-util.cc29
1 files changed, 12 insertions, 17 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 5d94f38371..9cbdf68bb1 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -7485,36 +7485,31 @@ bool monsters::can_drink_potion(potion_type ptype) const
bool monsters::should_drink_potion(potion_type ptype) const
{
- bool rc = false;
switch (ptype)
{
case POT_HEALING:
- rc = (hit_points <= max_hit_points / 2)
- || has_ench(ENCH_POISON)
- || has_ench(ENCH_SICK)
- || has_ench(ENCH_CONFUSION)
- || has_ench(ENCH_ROT);
- break;
+ return (hit_points <= max_hit_points / 2)
+ || has_ench(ENCH_POISON)
+ || has_ench(ENCH_SICK)
+ || has_ench(ENCH_CONFUSION)
+ || has_ench(ENCH_ROT);
case POT_HEAL_WOUNDS:
- rc = (hit_points <= max_hit_points / 2);
- break;
+ return (hit_points <= max_hit_points / 2);
case POT_BLOOD:
case POT_BLOOD_COAGULATED:
- rc = (hit_points <= max_hit_points / 2);
- break;
+ return (hit_points <= max_hit_points / 2);
case POT_SPEED:
- rc = !has_ench(ENCH_HASTE);
- break;
+ return (!has_ench(ENCH_HASTE));
case POT_INVISIBILITY:
// We're being nice: friendlies won't go invisible
// if the player won't be able to see them.
- rc = !has_ench(ENCH_INVIS)
- && (player_see_invis(false) || !mons_friendly(this));
- break;
+ return (!has_ench(ENCH_INVIS)
+ && (player_see_invis(false) || !mons_friendly(this)));
default:
break;
}
- return rc;
+
+ return (false);
}
// Return the ID status gained.