summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-21 16:59:51 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-21 16:59:51 +0000
commit70c9cdbfc3009b64f58482a1506848ed6437e1f3 (patch)
treedf0bb067542a45239a4f8fe12bdf53435320871b /crawl-ref/source/spells3.cc
parentd9bc7dea9dcba85e9db47593ba32ccc49df70221 (diff)
downloadcrawl-ref-70c9cdbfc3009b64f58482a1506848ed6437e1f3.tar.gz
crawl-ref-70c9cdbfc3009b64f58482a1506848ed6437e1f3.zip
Cleanups for cast_twisted_resurrection().
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6626 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc33
1 files changed, 11 insertions, 22 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index aabfc95a42..9796b12cfa 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1055,39 +1055,28 @@ bool cast_simulacrum(int pow, god_type god)
bool cast_twisted_resurrection(int pow, god_type god)
{
- if (igrd[you.x_pos][you.y_pos] == NON_ITEM)
- {
- mpr("There's nothing here!");
- return (false);
- }
-
- int objl = igrd[you.x_pos][you.y_pos];
- int next;
-
int how_many_corpses = 0;
int total_mass = 0;
int rotted = 0;
- while (objl != NON_ITEM)
+ for ( stack_iterator si(you.pos()); si; ++si )
{
- next = mitm[objl].link;
-
- if (mitm[objl].base_type == OBJ_CORPSES
- && mitm[objl].sub_type == CORPSE_BODY)
+ if (si->base_type == OBJ_CORPSES && si->sub_type == CORPSE_BODY)
{
- total_mass += mons_weight(mitm[objl].plus);
-
+ total_mass += mons_weight(si->plus);
how_many_corpses++;
-
- if (food_is_rotten(mitm[objl]))
+ if (food_is_rotten(*si))
rotted++;
-
- destroy_item(objl);
+ destroy_item(si->index());
}
-
- objl = next;
}
+ if (how_many_corpses == 0)
+ {
+ mpr("There are no corpses here!");
+ return (false);
+ }
+
#if DEBUG_DIAGNOSTICS
mprf(MSGCH_DIAGNOSTICS, "Mass for abomination: %d", total_mass);
#endif