]> git.tdb.fi Git - libs/game.git/blobdiff - source/game/stage.cpp
Enforce no creation or destruction of objects during tick
[libs/game.git] / source / game / stage.cpp
index 81893e1e1ef8c27ca72db42e456c78462a999452..bdd0ed676d27200fe87c9ee89e4231874b643f69 100644 (file)
@@ -1,4 +1,5 @@
 #include "stage.h"
+#include "accessguard.h"
 #include "camera.h"
 #include "root.h"
 #include "system.h"
@@ -53,8 +54,14 @@ void Stage::synthesize_initial_events(Handle<Entity> entity, EventObserver &targ
 
 void Stage::tick(Time::TimeDelta dt)
 {
-       for(const auto &s: systems)
-               s->tick(dt);
+       {
+#ifdef DEBUG
+               AccessGuard::BlockForScope _block;;
+#endif
+               for(const auto &s: systems)
+                       s->tick(dt);
+       }
+
        for(const auto &s: systems)
                s->deferred_tick();
 }