summaryrefslogtreecommitdiffhomepage
path: root/serialize/world-reader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'serialize/world-reader.cpp')
-rw-r--r--serialize/world-reader.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp
index d61a574a..eb775e77 100644
--- a/serialize/world-reader.cpp
+++ b/serialize/world-reader.cpp
@@ -136,7 +136,13 @@ void reader_state::read_chunks(reader_t& s)
using uchar = std::uint8_t;
const auto make_atlas = [&]() -> tile_image_proto {
auto id = flags & meta_short_atlasid ? atlasid{s.read<uchar>()} : s.read<atlasid>();
- auto v = s.read<variant_t>();
+ variant_t v;
+ if (PROTO >= 2) [[likely]]
+ s >> v;
+ else
+ v = flags & meta_short_variant_
+ ? s.read<std::uint8_t>()
+ : std::uint8_t(s.read<std::uint16_t>());
auto atlas = lookup_atlas(id);
fm_assert(v < atlas->num_tiles());
return { atlas, v };