diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-17 23:20:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-17 23:23:12 +0100 |
commit | 90c43f035f41cf901832794f0b4e00c2b5569723 (patch) | |
tree | 4cb7bc4f09509c03bbeb3cb3fcf6b115fca910f0 /src/chunk.inl | |
parent | c17cef93bd6bbc1b071dcd82df0dbc9420e52ef4 (diff) |
dddd
Diffstat (limited to 'src/chunk.inl')
-rw-r--r-- | src/chunk.inl | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/chunk.inl b/src/chunk.inl deleted file mode 100644 index 132657ab..00000000 --- a/src/chunk.inl +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once -#include "chunk.hpp" -#include "scenery.hpp" - -namespace floormat { - -template<typename F> -requires requires(F fun) { fun(); } -void chunk::with_scenery_update(entity& s, F&& fun) -{ - static_assert(std::is_convertible_v<decltype(fun()), bool> || std::is_same_v<void, decltype(fun())>); - - // todo handle coord & offset fields - - auto ch = s.coord.chunk(); - entity_proto s0(s); - bbox bb0; bool b0 = _bbox_for_scenery(s, bb0); - - bool modified = true; - if constexpr(!std::is_same_v<void, std::decay_t<decltype(fun())>>) - modified = fun(); - else - fun(); - if (!modified) - return; - - if (s.coord.chunk() != ch) // todo - return; - - if (bbox bb; !is_passability_modified()) - if (bool b = _bbox_for_scenery(s, bb); b != b0 || bb != bb0) - _replace_bbox(bb0, bb, b0, b); - if (!is_scenery_modified() && !s.is_dynamic() && entity_proto(s) != s0) - mark_scenery_modified(false); -} - -} // namespace floormat |