summaryrefslogtreecommitdiff
path: root/src/squeltch.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/squeltch.cc')
-rw-r--r--src/squeltch.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/squeltch.cc b/src/squeltch.cc
index f2366813..8e8c5b8f 100644
--- a/src/squeltch.cc
+++ b/src/squeltch.cc
@@ -64,11 +64,11 @@ void squeltch_grid(void)
return;
}
+ // Copy list of objects since we may modify it
+ auto const object_idxs(cave[p_ptr->py][p_ptr->px].o_idxs);
+
// Scan the pile of objects
- s16b next_o_idx = 0;
- for (s16b this_o_idx = cave[p_ptr->py][p_ptr->px].o_idx;
- this_o_idx;
- this_o_idx = next_o_idx)
+ for (auto const this_o_idx: object_idxs)
{
// Acquire object
object_type * o_ptr = &o_list[this_o_idx];
@@ -79,9 +79,6 @@ void squeltch_grid(void)
object_aware(o_ptr);
}
- // Acquire next object
- next_o_idx = o_ptr->next_o_idx;
-
// Apply rules
automatizer->apply_rules(o_ptr, -this_o_idx);
}