diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-02 18:53:21 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2019-09-02 18:53:21 -0400 |
commit | aa7b0a92d065b4435467d482ec65dd97b03459ee (patch) | |
tree | 0b1c4406f4fbeea6fee2e73eaf735386c5cc1ab6 /lib | |
parent | 6614ea639414caab546091841bf920fe6459cc9e (diff) |
made json names readable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/entityx/entityx/Entity.h | 8 |
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(); } } } |