summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-18 00:50:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-18 00:50:41 +0100
commit436cbfd415b19b7f41c49eda466f16a6860de45e (patch)
treead3eda3f257e2f9d4c540123c2c44e7aca145fae /serialize
parent20103801109e0d3872f0f314e60127c7dbe407cb (diff)
a
Diffstat (limited to 'serialize')
-rw-r--r--serialize/world-reader.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp
index b79a1122..78e7e539 100644
--- a/serialize/world-reader.cpp
+++ b/serialize/world-reader.cpp
@@ -302,16 +302,16 @@ void reader_state::deserialize_world(ArrayView<const char> buf)
fm_throw("bad proto version '{}' (should be between '{}' and '{}')"_cf,
(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)
+ if (PROTO >= 3) [[likely]]
read_sceneries(s);
read_chunks(s);
- if (PROTO >= 8)
- {
- fm_assert(_world->entity_counter() == 0);
- _world->set_entity_counter(s.read<std::uint64_t>());
- }
s.assert_end();
+ fm_assert(_world->entity_counter() == 0);
+ _world->set_entity_counter(entity_counter);
_world = nullptr;
}