diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-21 10:42:46 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-05-21 10:42:46 -0400 |
| commit | baa0276594b5871d9e61ef4f454bc84074c44084 (patch) | |
| tree | 1083cb62c57d5a4cd325fab2275b02ae66bb849b /src/serialization-static-ui.cpp | |
| parent | 85cac31d06f5ef15b36aa6bc4edd31f85221a7b7 (diff) | |
pke: serialize nested ui-boxes
Diffstat (limited to 'src/serialization-static-ui.cpp')
| -rw-r--r-- | src/serialization-static-ui.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/serialization-static-ui.cpp b/src/serialization-static-ui.cpp index 4c45cc1..7f15b10 100644 --- a/src/serialization-static-ui.cpp +++ b/src/serialization-static-ui.cpp @@ -56,12 +56,13 @@ void pke_deserialize_ui_box_internal(srlztn_deserialize_helper *h, pke_kve_conta pk_handle pke_serialize_ui_box(srlztn_serialize_helper *h, pke_ui_box *box) { char *s; int len; - pk_handle internal_type_handle = PK_HANDLE_MAX; pke_kve kve{}; pke_kve_container kvec{}; + kvec.child_handles.bkt = h->bkt; + if (box->type == PKE_UI_BOX_TYPE_TEXT) { - internal_type_handle = pke_serialize_ui_box_internal(h, &box->type_data->text); + pk_arr_append_t(&kvec.child_handles, pke_serialize_ui_box_internal(h, &box->type_data->text)); } kvec.srlztn_handle = h->handle_head; @@ -69,11 +70,7 @@ pk_handle pke_serialize_ui_box(srlztn_serialize_helper *h, pke_ui_box *box) { kvec.bkt = h->bkt; kvec.arr.bkt = h->bkt; kvec.children.bkt = h->bkt; - kvec.child_handles.bkt = h->bkt; h->handle_head.itemIndex++; - if (internal_type_handle != PK_HANDLE_MAX) { - pk_arr_append_t(&kvec.child_handles, internal_type_handle); - } if (box->uuid != pk_uuid_zed && box->uuid != pk_uuid_max) { kve.key = SRLZTN_UI_BOX_UUID; @@ -161,6 +158,12 @@ pk_handle pke_serialize_ui_box(srlztn_serialize_helper *h, pke_ui_box *box) { } pk_arr_append_t(&h->kvp_containers, kvec); + pke_kve_container *kvec_ptr = &h->kvp_containers[h->kvp_containers.next-1]; + + for (pke_ui_box_count_T i = 0; i < box->internal.h_children; ++i) { + pk_arr_append_t(&kvec_ptr->child_handles, pke_serialize_ui_box(h, box->internal.children[i])); + } + kvec.arr.data = nullptr; kvec.children.data = nullptr; kvec.child_handles.data = nullptr; |
