aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/entityx/entityx/Entity.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/entityx/entityx/Entity.h b/lib/entityx/entityx/Entity.h
index 193d581..27a8820 100644
--- a/lib/entityx/entityx/Entity.h
+++ b/lib/entityx/entityx/Entity.h
@@ -243,6 +243,7 @@ struct BaseComponent {
void operator delete[]([[maybe_unused]] void *p) { fail(); }
virtual void internal_serialize(bool save, void *ar) = 0;
+ virtual std::string serializeName(void) const = 0;
protected:
static void fail() {
@@ -757,8 +758,11 @@ class EntityManager : entityx::help::NonCopyable {
for (size_t i = 0; i < component_helpers_.size(); i++) {
BaseComponentHelper *helper = component_helpers_[i];
if (helper && mask.test(i)) {
- helper->get_component(entity)->internal_serialize(save,
- static_cast<void*>(&ar));
+ auto* c = helper->get_component(entity);
+ ar.setNextName(c->serializeName().c_str());
+ ar.startNode();
+ c->internal_serialize(save, static_cast<void*>(&ar));
+ ar.finishNode();
}
}
}