diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 15:19:35 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-18 15:31:06 +0100 |
| commit | d4ae141eee51825fccf2350a6d8b906f24d57a95 (patch) | |
| tree | d9854dc3beb23f370455aa4e2c7bdac086ca3ed0 /serialize | |
| parent | 8104af61d21dc48fc163ca5c1124a9e4c5911fdc (diff) | |
serialize/save: store entity counter right before chunks
Diffstat (limited to 'serialize')
| -rw-r--r-- | serialize/world-reader.cpp | 4 | ||||
| -rw-r--r-- | serialize/world-writer.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index 84958109..dc698765 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -307,11 +307,11 @@ void reader_state::deserialize_world(ArrayView<const char> buf) (std::size_t)proto, (std::size_t)min_proto_version, (std::size_t)proto_version); PROTO = proto; std::uint64_t entity_counter = 0; - if (PROTO >= 8) [[likely]] - entity_counter << s; read_atlases(s); if (PROTO >= 3) [[likely]] read_sceneries(s); + if (PROTO >= 8) [[likely]] + entity_counter << s; read_chunks(s); s.assert_end(); if (PROTO >= 8) [[likely]] diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp index 461f6dd6..f3af1c19 100644 --- a/serialize/world-writer.cpp +++ b/serialize/world-writer.cpp @@ -503,9 +503,9 @@ ArrayView<const char> writer_state::serialize_world() }; copy(Containers::StringView{file_magic, std::size(file_magic)-1}); copy_int((proto_t)proto_version); - copy_int((std::uint64_t)_world->entity_counter()); copy(atlas_buf); copy(scenery_buf); + copy_int((std::uint64_t)_world->entity_counter()); copy_int((chunksiz)_world->size()); for (const auto& buf : chunk_bufs) copy(buf); |
