diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-01 18:08:50 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-01 18:08:50 +0100 |
| commit | 310d7d2639ebc6ecba0e3367a401595e1e8f974b (patch) | |
| tree | 68edc60fbc97957fe79da4ba9bb2f86d26a10184 /editor | |
| parent | 257c2420545eb632a53c0fe3cd317be613dcb272 (diff) | |
src: optimize bbox replacement in update loop
Diffstat (limited to 'editor')
| -rw-r--r-- | editor/imgui-inspect.cpp | 1 | ||||
| -rw-r--r-- | editor/inspect-types.cpp | 1 | ||||
| -rw-r--r-- | editor/update.cpp | 5 |
3 files changed, 5 insertions, 2 deletions
diff --git a/editor/imgui-inspect.cpp b/editor/imgui-inspect.cpp index 529ef1a9..d4bf9da2 100644 --- a/editor/imgui-inspect.cpp +++ b/editor/imgui-inspect.cpp @@ -4,6 +4,7 @@ #include "floormat/main.hpp" #include "src/world.hpp" #include "imgui-raii.hpp" +#include "chunk.inl" namespace floormat { diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 1168a88a..185cfad7 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -7,6 +7,7 @@ #include "inspect.hpp" #include "loader/loader.hpp" #include "chunk.hpp" +#include "chunk.inl" #include <Corrade/Containers/ArrayViewStl.h> //#define TEST_STR diff --git a/editor/update.cpp b/editor/update.cpp index a907117a..62dcc977 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -5,6 +5,7 @@ #include "main/clickable.hpp" #include "floormat/events.hpp" #include "floormat/main.hpp" +#include "chunk.inl" namespace floormat { @@ -164,8 +165,8 @@ void app::update_world(float dt) for (std::int16_t y = miny; y <= maxy; y++) for (std::int16_t x = minx; x <= maxx; x++) for (auto& c = world[chunk_coords{x, y}]; auto [x, k, pt] : c) - if (auto sc = x.scenery()) - c.with_scenery_bbox_update(sc.index(), [&] { sc.update(dt); }); + if (auto sc = x.scenery(); sc && sc.can_activate()) + c.with_scenery_bbox_update(sc.index(), [&] { return sc.update(dt); }); } void app::set_cursor() |
