summaryrefslogtreecommitdiff
path: root/src/squeltch.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-06-12 06:27:05 +0200
committerBardur Arantsson <bardur@scientician.net>2015-08-01 17:26:10 +0200
commitc6196b25d119a10e79deedef26a73e0d5a021b0e (patch)
tree199f5bff5cf363787eb610caa495fd3682a463ed /src/squeltch.cc
parent000f6272f8ab1d43ec6300fb5972f7813ada1c88 (diff)
Refactor cave_type and monster_type to use non-intrusive lists
We use vectors of object indexes instead of embedding the list within object_type itself.
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);
}