summaryrefslogtreecommitdiffhomepage
path: root/src/chunk-collision.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-17 23:20:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-17 23:23:12 +0100
commit90c43f035f41cf901832794f0b4e00c2b5569723 (patch)
tree4cb7bc4f09509c03bbeb3cb3fcf6b115fca910f0 /src/chunk-collision.cpp
parentc17cef93bd6bbc1b071dcd82df0dbc9420e52ef4 (diff)
dddd
Diffstat (limited to 'src/chunk-collision.cpp')
-rw-r--r--src/chunk-collision.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp
index c64d9a5b..c228c514 100644
--- a/src/chunk-collision.cpp
+++ b/src/chunk-collision.cpp
@@ -96,9 +96,9 @@ void chunk::ensure_passability() noexcept
}
}
-bool chunk::_bbox_for_scenery(const entity& s, local_coords local, Vector2b offset, bbox& value) noexcept
+bool chunk::_bbox_for_scenery(const entity& s, local_coords local, Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size, bbox& value) noexcept
{
- auto [start, end] = scenery_tile(local, offset, s.bbox_offset, s.bbox_size);
+ auto [start, end] = scenery_tile(local, offset, bbox_offset, bbox_size);
auto id = make_id(collision_type::scenery, s.pass, s.id);
value = { .id = id, .start = start, .end = end };
return s.atlas && s.pass != pass_mode::pass;
@@ -106,27 +106,26 @@ bool chunk::_bbox_for_scenery(const entity& s, local_coords local, Vector2b offs
bool chunk::_bbox_for_scenery(const entity& s, bbox& value) noexcept
{
- return _bbox_for_scenery(s, s.coord.local(), s.offset, value);
+ return _bbox_for_scenery(s, s.coord.local(), s.offset, s.bbox_offset, s.bbox_size, value);
}
void chunk::_remove_bbox(const bbox& x)
{
- if (_scenery_modified)
- return;
auto start = Vector2(x.start), end = Vector2(x.end);
_rtree.Remove(start.data(), end.data(), x.id);
}
void chunk::_add_bbox(const bbox& x)
{
- if (_scenery_modified)
- return;
auto start = Vector2(x.start), end = Vector2(x.end);
_rtree.Insert(start.data(), end.data(), x.id);
}
void chunk::_replace_bbox(const bbox& x0, const bbox& x1, bool b0, bool b1)
{
+ if (_pass_modified)
+ return;
+
unsigned i = (unsigned)b1 << 1 | (unsigned)(b0 ? 1 : 0) << 0;
CORRADE_ASSUME(i < 4u);