diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-30 00:28:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-30 00:28:21 +0100 |
commit | 01a8ae2ddf4b52fb9a7d5d46e433c19a5efcfa8d (patch) | |
tree | 01adb13c9c97a34b814a965d64ed72fd48aad86e /serialize/world-reader.cpp | |
parent | 1b5a4bb5084c79a79da50affc5d9c8cd94fd47d7 (diff) |
tile, serialize/save: limit tile atlas size to 0xff
Diffstat (limited to 'serialize/world-reader.cpp')
-rw-r--r-- | serialize/world-reader.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index 2ec62015..f792de1a 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -67,8 +67,8 @@ void reader_state::read_chunks(reader_t& s) tile_ref t = chunk[i]; 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 = flags & meta_short_variant ? (varid) (s.read<uchar>()) : s.read<varid>(); + auto id = flags & meta_short_atlasid ? atlasid{s.read<uchar>()} : s.read<atlasid>(); + auto v = s.read<variant_t>(); auto atlas = lookup_atlas(id); fm_assert(v < atlas->num_tiles()); return { atlas, v }; |