From 310d7d2639ebc6ecba0e3367a401595e1e8f974b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 1 Mar 2023 18:08:50 +0100 Subject: src: optimize bbox replacement in update loop --- editor/update.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'editor/update.cpp') 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() -- cgit v1.2.3