summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/religion.cc10
-rw-r--r--crawl-ref/source/spells4.cc19
-rw-r--r--crawl-ref/source/traps.cc14
3 files changed, 15 insertions, 28 deletions
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index cc6156923b..9cc12f70d4 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1937,15 +1937,13 @@ static bool _confirm_pray_sacrifice()
return (false);
}
- for ( int i = igrd[you.x_pos][you.y_pos]; i != NON_ITEM;
- i = mitm[i].link )
+ for ( stack_iterator si(you.pos()); si; ++si )
{
- const item_def& item = mitm[i];
- if ( _is_risky_sacrifice(item)
- || has_warning_inscription(item, OPER_PRAY) )
+ if ( _is_risky_sacrifice(*si)
+ || has_warning_inscription(*si, OPER_PRAY) )
{
std::string prompt = "Really sacrifice stack with ";
- prompt += item.name(DESC_NOCAP_A);
+ prompt += si->name(DESC_NOCAP_A);
prompt += " in it?";
if ( !yesno(prompt.c_str(), false, 'n') )
return (false);
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index d232ed51b9..4384a84ced 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1464,24 +1464,17 @@ void cast_fulsome_distillation( int powc )
int corpse = -1;
- // Search items at the players location for corpses.
- // XXX: Turn this into a separate function and merge with
- // the messes over in butchery, animating, and maybe even
- // item pickup from stacks (which would make it easier to
- // create a floor stack menu system later) -- bwr
- for (int curr_item = igrd[you.x_pos][you.y_pos];
- curr_item != NON_ITEM;
- curr_item = mitm[curr_item].link)
- {
- const item_def& item = mitm[curr_item];
- if (item.base_type == OBJ_CORPSES && item.sub_type == CORPSE_BODY)
+ // Search items at the player's location for corpses.
+ for (stack_iterator si(you.pos()); si; ++si)
+ {
+ if (si->base_type == OBJ_CORPSES && si->sub_type == CORPSE_BODY)
{
snprintf( info, INFO_SIZE, "Distill a potion from %s?",
- item.name(DESC_NOCAP_THE).c_str() );
+ si->name(DESC_NOCAP_THE).c_str() );
if (yesno( info, true, 0, false ))
{
- corpse = curr_item;
+ corpse = si->index();
break;
}
}
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index d321f6e860..5822d624f3 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -49,17 +49,13 @@ static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison);
// otherwise the first net found is returned.
int get_trapping_net(int x, int y, bool trapped)
{
- int net, next;
-
- for (net = igrd[x][y]; net != NON_ITEM; net = next)
+ for (stack_iterator si(coord_def(x,y)); si; ++si)
{
- next = mitm[net].link;
-
- if (mitm[net].base_type == OBJ_MISSILES
- && mitm[net].sub_type == MI_THROWING_NET
- && (!trapped || item_is_stationary(mitm[net])))
+ if (si->base_type == OBJ_MISSILES
+ && si->sub_type == MI_THROWING_NET
+ && (!trapped || item_is_stationary(*si)))
{
- return (net);
+ return (si->index());
}
}
return (NON_ITEM);