diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-07 23:48:29 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-06-08 01:11:45 +0200 |
commit | f074995fb573fd8a9e1da8ba3338d1d5e4a9ca63 (patch) | |
tree | 5c142cf0fa83575b387f48f10a724c974c4c489a /src | |
parent | 05804f5f7f8b2dfad65e51a0e37ccb3c16b4d477 (diff) |
w
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp index d8c660bb..6cad7cf7 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -143,10 +143,13 @@ void chunk::add_object_pre(const std::shared_ptr<object>& e) const auto dyn = e->is_dynamic(), upd = e->updates_passability(); if (!dyn) mark_scenery_modified(); - if (!dyn || upd) - _add_bbox_static_(); - else if (bbox bb; _bbox_for_scenery(*e, bb)) - _add_bbox_dynamic(bb); + if (!_pass_modified) [[likely]] + { + if (!dyn || upd) + _add_bbox_static_(); + else if (bbox bb; _bbox_for_scenery(*e, bb)) + _add_bbox_dynamic(bb); + } } void chunk::add_object_unsorted(const std::shared_ptr<object>& e) @@ -191,10 +194,13 @@ void chunk::remove_object(size_t i) const auto dyn = e.is_dynamic(), upd = e.updates_passability(); if (!dyn) mark_scenery_modified(); - if (!dyn || upd) - _remove_bbox_static_(); - else if (bbox bb; _bbox_for_scenery(e, bb)) - _remove_bbox_dynamic(bb); + if (!_pass_modified) [[likely]] + { + if (!dyn || upd) + _remove_bbox_static_(); + else if (bbox bb; _bbox_for_scenery(e, bb)) + _remove_bbox_dynamic(bb); + } } arrayRemove(_objects, i); |