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/update.cpp | |
| parent | 257c2420545eb632a53c0fe3cd317be613dcb272 (diff) | |
src: optimize bbox replacement in update loop
Diffstat (limited to 'editor/update.cpp')
| -rw-r--r-- | editor/update.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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() |
