From 85ba301f52b1c7e1ad928803b14b6c70776f2235 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sat, 16 Dec 2023 11:47:59 -0500 Subject: use hashmap for compound tag --- src/nbt/print.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/nbt/print.c') diff --git a/src/nbt/print.c b/src/nbt/print.c index 4eac31f..3f687dc 100644 --- a/src/nbt/print.c +++ b/src/nbt/print.c @@ -64,9 +64,11 @@ static bool nbt_print_list(const tagdata_t *data, const stream_t *stream) { } static bool nbt_print_compound(const tagdata_t *data, const stream_t *stream) { - for (int32_t i = 0; i < data->compound.size; i++) - if (nbt_print(&data->compound.tags[i], stream) == false) + for (uint32_t i = 0; i < data->compound.capacity; i++) { + if (data->compound.entries[i].name == NULL) continue; + if (nbt_print(&data->compound.entries[i], stream) == false) return false; + } if (stream_write_i8(stream, TAG_END) == false) return false; return true; -- cgit v1.2.3-freya