diff options
author | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-04 02:58:07 -0400 |
---|---|---|
committer | Andy Belle-Isle <drumsetmonkey@gmail.com> | 2019-09-04 02:58:07 -0400 |
commit | 1549ecad22294cae6f1a2e6e6b256b2192b0c3d3 (patch) | |
tree | 9f2f99fcb9b09216b252abcf2cbbd0b7b0e32e38 /src/engine.cpp | |
parent | 3f39453ca9d3bacfffaa6cdb5e4f531fee9020dd (diff) |
Values in entity table are now saved in the save file
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 10 |
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) |