summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-goditem.cc
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-06-26 21:59:25 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-06-26 22:25:41 -0700
commit358e3e32b8045aaea1f830060ecea228ff53389d (patch)
tree11db7192d8d5efbcb0f2da6c58a8c111c6b77cf4 /crawl-ref/source/spl-goditem.cc
parentd16265b1dca17f728ff9a9900cd72ea716958647 (diff)
downloadcrawl-ref-358e3e32b8045aaea1f830060ecea228ff53389d.tar.gz
crawl-ref-358e3e32b8045aaea1f830060ecea228ff53389d.zip
Partially refactor cast_healing()
Diffstat (limited to 'crawl-ref/source/spl-goditem.cc')
-rw-r--r--crawl-ref/source/spl-goditem.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index 275a20138f..af016c526d 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -163,10 +163,9 @@ static vector<string> _desc_mindless(const monster_info& mi)
return descs;
}
-// Returns: 1 -- success, 0 -- failure, -1 -- cancel
-static int _healing_spell(int healed, int max_healed, bool divine_ability,
- const coord_def& where, bool not_self,
- targ_mode_type mode)
+static spret_type _healing_spell(int healed, int max_healed,
+ bool divine_ability, const coord_def& where,
+ bool not_self, targ_mode_type mode)
{
ASSERT(healed >= 1);
@@ -189,19 +188,19 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability,
}
if (!spd.isValid)
- return -1;
+ return SPRET_ABORT;
if (spd.target == you.pos())
{
if (not_self)
{
mpr("You can only heal others!");
- return -1;
+ return SPRET_ABORT;
}
mpr("You are healed.");
inc_hp(healed);
- return 1;
+ return SPRET_SUCCESS;
}
monster* mons = monster_at(spd.target);
@@ -210,7 +209,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability,
canned_msg(MSG_NOTHING_THERE);
// This isn't a cancel, to avoid leaking invisible monster
// locations.
- return 0;
+ return SPRET_FAIL;
}
const int can_pacify = _can_pacify_monster(mons, healed, max_healed);
@@ -225,19 +224,19 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability,
{
mprf("The light of Elyvilon fails to reach %s.",
mons->name(DESC_THE).c_str());
- return 0;
+ return SPRET_FAIL;
}
else if (can_pacify == -3)
{
mprf("The light of Elyvilon almost touches upon %s.",
mons->name(DESC_THE).c_str());
- return 0;
+ return SPRET_FAIL;
}
else if (can_pacify == -4)
{
mprf("%s is completely unfazed by your meager offer of peace.",
mons->name(DESC_THE).c_str());
- return 0;
+ return SPRET_FAIL;
}
else
{
@@ -248,7 +247,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability,
}
else
mpr("You cannot pacify this monster!");
- return -1;
+ return SPRET_ABORT;
}
}
@@ -320,15 +319,15 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability,
if (!did_something)
{
canned_msg(MSG_NOTHING_HAPPENS);
- return 0;
+ return SPRET_FAIL;
}
- return 1;
+ return SPRET_SUCCESS;
}
-// Returns: 1 -- success, 0 -- failure, -1 -- cancel
-int cast_healing(int pow, int max_pow, bool divine_ability,
- const coord_def& where, bool not_self, targ_mode_type mode)
+spret_type cast_healing(int pow, int max_pow, bool divine_ability,
+ const coord_def& where, bool not_self,
+ targ_mode_type mode)
{
pow = min(50, pow);
max_pow = min(50, max_pow);