aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index fe9af3d..9e77b40 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -100,11 +100,6 @@ void Engine::logicLoop(void)
elapsed += dt;
std::this_thread::yield();
}
-
- // Remove all Lua references from entities
- entities.each<Scripted>([](entityx::Entity, Scripted &f){ f.cleanup(); });
- entities.each<EventListener>([](entityx::Entity, EventListener &f){
- f.cleanup(); });
}
void Engine::renderLoop(void)
@@ -130,6 +125,11 @@ void Engine::run(void)
// Save the entities' data
GameState::save("save.json", entities);
+
+ // Remove all Lua references from entities
+ entities.each<Scripted>([](entityx::Entity, Scripted &f){ f.cleanup(); });
+ entities.each<EventListener>([](entityx::Entity, EventListener &f){
+ f.cleanup(); });
}
bool Engine::shouldRun(void)