diff options
author | Freya Murphy <freya@freyacat.org> | 2023-12-16 11:47:59 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2023-12-16 11:47:59 -0500 |
commit | 85ba301f52b1c7e1ad928803b14b6c70776f2235 (patch) | |
tree | 28902147b9bf6c393497e21b0cb21c8b957aa3e2 /src/nbt/print.c | |
parent | fix hang on incomplete json ident (diff) | |
download | nbtvis-85ba301f52b1c7e1ad928803b14b6c70776f2235.tar.gz nbtvis-85ba301f52b1c7e1ad928803b14b6c70776f2235.tar.bz2 nbtvis-85ba301f52b1c7e1ad928803b14b6c70776f2235.zip |
use hashmap for compound tag
Diffstat (limited to '')
-rw-r--r-- | src/nbt/print.c | 6 |
1 files changed, 4 insertions, 2 deletions
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; |