summaryrefslogtreecommitdiffhomepage
path: root/editor
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-05-02 18:32:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-05-02 22:54:16 +0200
commitb93032e49cd69da178984f9912205d182f12f61e (patch)
tree2caae8f9db5776a39a731e8fb82ed30ec7fb6b06 /editor
parent6abcd7d52cda334c58ec999d212491fc24f13c9d (diff)
now call script update
Diffstat (limited to 'editor')
-rw-r--r--editor/update.cpp28
1 files changed, 16 insertions, 12 deletions
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();
+ }
}
}
}