Skip to content

Commit 93f45ca

Browse files
committed
fix: restore missing serialize fn
1 parent 652ec5f commit 93f45ca

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

ecsact/runtime/serialize.hh

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@ ECSACT_ALWAYS_INLINE auto serialize( //
5353
}
5454

5555
/**
56-
* Serializes an ecsact_component when the type is unknown. Size and serialize
57-
* fn are passed in to work around various linking configurations.
56+
* Serializes an ecsact_component when the type is unknown.
5857
* @returns serialized action bytes
5958
*/
6059
ECSACT_ALWAYS_INLINE auto serialize( //
6160
const ecsact_component& component
6261
) -> std::vector<std::byte> {
6362
std::vector<std::byte> out_component;
6463
out_component.resize(ecsact_serialize_component_size(component.component_id));
65-
6664
ecsact_serialize_component(
6765
component.component_id,
6866
component.component_data,
@@ -71,6 +69,23 @@ ECSACT_ALWAYS_INLINE auto serialize( //
7169
return out_component;
7270
}
7371

72+
/**
73+
* Serializes an ecsact_action when the type is unknown.
74+
* @returns serialized action bytes
75+
*/
76+
ECSACT_ALWAYS_INLINE auto serialize( //
77+
const ecsact_action& action
78+
) -> std::vector<std::byte> {
79+
std::vector<std::byte> out_action;
80+
out_action.resize(ecsact_serialize_action_size(action.action_id));
81+
ecsact_serialize_action(
82+
action.action_id,
83+
action.action_data,
84+
reinterpret_cast<uint8_t*>(out_action.data())
85+
);
86+
return out_action;
87+
}
88+
7489
/**
7590
* Calls `ecsact_deserialize_action` or `ecsact_deserialize_component` based on
7691
* the type of @tp T.

0 commit comments

Comments
 (0)