From b93032e49cd69da178984f9912205d182f12f61e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 2 May 2024 18:32:22 +0200 Subject: now call script update --- editor/update.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'editor') diff --git a/editor/update.cpp b/editor/update.cpp index 0fe064c0..1e47d197 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -240,20 +240,24 @@ void app::update_world(Ns dt) continue; auto& c = *cʹ; const auto& es = c.objects(); - auto size = es.size(); - for (auto i = 0uz; i < size; i++) + auto size = (uint32_t)es.size(); + for (auto i = 0u; i < size; i++) { - auto& e = *es[i]; - if (e.last_frame_no == frame_no) [[unlikely]] - continue; - e.last_frame_no = frame_no; - const auto* const ch = &e.chunk(); - size_t index = i; - e.update(index, dt); - if (&e.chunk() != ch || (uint32_t)index > i) [[unlikely]] + auto eʹ = es[i]; + auto index = size_t{i}; + { + auto& e = *eʹ; + if (e.last_frame_no == frame_no) [[unlikely]] + continue; + e.last_frame_no = frame_no; + } { - i--; - size = es.size(); + eʹ->update(eʹ, index, dt); + if (&eʹ->chunk() != cʹ || index > i) [[unlikely]] + { + i--; + size = (uint32_t)es.size(); + } } } } -- cgit v1.2.3