aboutsummaryrefslogtreecommitdiffstats
path: root/src/gamestate.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamestate.hpp')
-rw-r--r--src/gamestate.hpp32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/gamestate.hpp b/src/gamestate.hpp
index 86a4198..3ef641f 100644
--- a/src/gamestate.hpp
+++ b/src/gamestate.hpp
@@ -27,30 +27,6 @@
#include <fstream>
-struct EntitySerializer
-{
- template<class Archive>
- static void serialize(entityx::EntityManager& entities, entityx::Entity entity, bool save, Archive& ar)
- {
- // TODO try and reimplement without modifying entityx?
- // Or, make a new branch...
-
- //const auto mask = entity.component_mask();
-
- //for (size_t i = 0; i < entities.component_helpers_.size(); i++) {
- // auto helper = entities.component_helpers_[i];
- // if (helper && mask.test(i)) {
- // auto* c = helper->get_component(entity);
- // ar.setNextName(c->serializeName().c_str());
- // ar.startNode();
- // c->internal_serialize(save, static_cast<void*>(&ar));
- // ar.finishNode();
- // }
- //}
- }
-};
-
-
/**
* @class GameState
* Manages save files that contain entity data.
@@ -122,7 +98,13 @@ private:
for (auto entity : entities.entities_for_debugging()) {
archive.setNextName((name + std::to_string(i++)).c_str());
archive.startNode();
- EntitySerializer::serialize(entities, entity, save, archive);
+ entities.serialize(entity,
+ [&archive, &save](auto c) {
+ archive.setNextName(c->serializeName().c_str());
+ archive.startNode();
+ c->internal_serialize(save, static_cast<void*>(&archive));
+ archive.finishNode();
+ });
archive.finishNode();
}
}