Skip to content

Commit 720beb0

Browse files
committed
e
1 parent 2902acc commit 720beb0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/chunk-collision.cpp

+8-7
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,13 @@ void chunk::ensure_passability() noexcept
139139
//Debug{} << ".. reset passability" << _coord;
140140

141141
bool has_holes = false;
142+
auto& rtree = *_rtree;
142143
{
143-
has_holes |= add_holes_from_chunk<false>(*_rtree, *this, {});
144+
has_holes |= add_holes_from_chunk<false>(rtree, *this, {});
144145
const auto nbs = _world->neighbors(_coord);
145146
for (auto i = 0u; i < 8; i++)
146147
if (nbs[i])
147-
has_holes |= add_holes_from_chunk<true>(*_rtree, *nbs[i], world::neighbor_offsets[i]);
148+
has_holes |= add_holes_from_chunk<true>(rtree, *nbs[i], world::neighbor_offsets[i]);
148149
}
149150

150151
for (auto i = 0u; i < TILE_COUNT; i++)
@@ -156,7 +157,7 @@ void chunk::ensure_passability() noexcept
156157
if (pass == pass_mode::pass) [[likely]]
157158
continue;
158159
auto id = make_id(collision_type::geometry, pass, i+1);
159-
filter_through_holes(*_rtree, id, min, max, has_holes);
160+
filter_through_holes(rtree, id, min, max, has_holes);
160161
}
161162
}
162163
for (auto i = 0u; i < TILE_COUNT; i++)
@@ -166,19 +167,19 @@ void chunk::ensure_passability() noexcept
166167
{
167168
auto [min, max] = wall_north(i, (float)atlas->info().depth);
168169
auto id = make_id(collision_type::geometry, atlas->info().passability, TILE_COUNT+i+1);
169-
filter_through_holes(*_rtree, id, min, max, has_holes);
170+
filter_through_holes(rtree, id, min, max, has_holes);
170171

171172
if (tile.wall_west_atlas())
172173
{
173174
auto [min, max] = wall_pillar(i, (float)atlas->info().depth);
174-
filter_through_holes(*_rtree, id, min, max, has_holes);
175+
filter_through_holes(rtree, id, min, max, has_holes);
175176
}
176177
}
177178
if (const auto* atlas = tile.wall_west_atlas().get())
178179
{
179180
auto [min, max] = wall_west(i, (float)atlas->info().depth);
180181
auto id = make_id(collision_type::geometry, atlas->info().passability, TILE_COUNT*2+i+1);
181-
filter_through_holes(*_rtree, id, min, max, has_holes);
182+
filter_through_holes(rtree, id, min, max, has_holes);
182183
}
183184
}
184185
for (const bptr<object>& eʹ : objects())
@@ -189,7 +190,7 @@ void chunk::ensure_passability() noexcept
189190
if (_bbox_for_scenery(*eʹ, bb))
190191
{
191192
if (!eʹ->is_dynamic())
192-
filter_through_holes(*_rtree, std::bit_cast<object_id>(bb.data), Vector2(bb.start), Vector2(bb.end), has_holes);
193+
filter_through_holes(rtree, std::bit_cast<object_id>(bb.data), Vector2(bb.start), Vector2(bb.end), has_holes);
193194
else
194195
_add_bbox_dynamic(bb);
195196
}

0 commit comments

Comments
 (0)