From 70c9cdbfc3009b64f58482a1506848ed6437e1f3 Mon Sep 17 00:00:00 2001 From: haranp Date: Mon, 21 Jul 2008 16:59:51 +0000 Subject: Cleanups for cast_twisted_resurrection(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6626 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spells3.cc | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'crawl-ref/source/spells3.cc') 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 -- cgit v1.2.3-54-g00ecf