diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-23 05:40:11 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-01-23 05:40:11 +0000 |
commit | 8ba107149b1da7f22fa0ca7faa369a93a6d0cb29 (patch) | |
tree | e4004bc4ec62ffd8605cf7552d1e3b684553e4d2 /crawl-ref/source/spells3.cc | |
parent | a19dd0dd929c31c3fbeb0479a2498df3b51ad057 (diff) | |
download | crawl-ref-8ba107149b1da7f22fa0ca7faa369a93a6d0cb29.tar.gz crawl-ref-8ba107149b1da7f22fa0ca7faa369a93a6d0cb29.zip |
Make messages for animating single skeletons/corpses versus multiple
ones consistent. Also, display a proper warning message if a player
tries to animate a single skeleton/corpse while not actually standing on
one.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8707 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r-- | crawl-ref/source/spells3.cc | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index f931e6c763..502733785f 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -872,23 +872,27 @@ static bool _raise_remains(const coord_def &a, int corps, beh_type beha, return (false); } -bool animate_remains(const coord_def &a, corpse_type class_allowed, - beh_type beha, unsigned short hitting, - god_type god, bool actual, - bool quiet, int* mon_index) +int animate_remains(const coord_def &a, corpse_type class_allowed, + beh_type beha, unsigned short hitting, + god_type god, bool actual, + bool quiet, int* mon_index) { if (is_sanctuary(a)) - return (false); + return (0); + int number_found = 0; bool success = false; // Search all the items on the ground for a corpse. for (stack_iterator si(a); si; ++si) { - if (_animatable_remains(*si) - && (class_allowed == CORPSE_BODY - || si->sub_type == CORPSE_SKELETON)) + if (class_allowed == CORPSE_BODY || si->sub_type == CORPSE_SKELETON) { + number_found++; + + if (!_animatable_remains(*si)) + continue; + const bool was_butchering = is_being_butchered(*si); success = _raise_remains(a, si.link(), beha, hitting, god, actual, @@ -913,7 +917,13 @@ bool animate_remains(const coord_def &a, corpse_type class_allowed, } } - return (success); + if (number_found == 0) + return (-1); + + if (!success) + return (0); + + return (1); } int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, @@ -969,7 +979,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, const bool was_butchering = is_being_butchered(*si, false); if (animate_remains(a, CORPSE_BODY, beha, hitting, god, - actual, true)) + actual, true) > 0) { number_raised++; |