finishing first step of serialization : the basics

This commit is contained in:
2026-09-07 19:42:15 -04:00
parent a462575af4
commit b1de6ccc49
8 changed files with 406 additions and 110 deletions
+13 -4
View File
@@ -2,7 +2,19 @@
#include <Core/Common/serialization.h>
DEFINE_CLASS_VERSIONED(Entity, 1, nullptr, nullptr)
namespace
{
void serialize_entity(Archive& ar, uint16 /*version*/, void* payload)
{
Assert(payload);
Entity* entity = static_cast<Entity*>(payload);
SERIALIZE(ar, id, entity->ID);
SERIALIZE(ar, position, entity->position);
}
} // namespace
DEFINE_CLASS_VERSIONED(Entity, 1, nullptr, serialize_entity)
DEFINE_ENTITY_VERSIONED(Inert, 1, nullptr)
@@ -11,9 +23,6 @@ void serialize(Archive& ar, NonNullPtr<Entity> entity)
// Entity fields
serialize(ar, Entity::kind, entity.Get());
SERIALIZE(ar, id, entity->ID);
SERIALIZE(ar, position, entity->position);
// Derived fields
if (entity->derived_kind != nullptr && entity->derived != nullptr)
{