From aa7b0a92d065b4435467d482ec65dd97b03459ee Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 2 Sep 2019 18:53:21 -0400 Subject: made json names readable --- lib/entityx/entityx/Entity.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') 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(&ar)); + auto* c = helper->get_component(entity); + ar.setNextName(c->serializeName().c_str()); + ar.startNode(); + c->internal_serialize(save, static_cast(&ar)); + ar.finishNode(); } } } -- cgit v1.2.3