diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-17 23:20:46 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-17 23:23:12 +0100 |
commit | 90c43f035f41cf901832794f0b4e00c2b5569723 (patch) | |
tree | 4cb7bc4f09509c03bbeb3cb3fcf6b115fca910f0 /serialize | |
parent | c17cef93bd6bbc1b071dcd82df0dbc9420e52ef4 (diff) |
dddd
Diffstat (limited to 'serialize')
-rw-r--r-- | serialize/world-reader.cpp | 3 | ||||
-rw-r--r-- | serialize/world-writer.cpp | 7 |
2 files changed, 5 insertions, 5 deletions
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp index b38c16b4..b79a1122 100644 --- a/serialize/world-reader.cpp +++ b/serialize/world-reader.cpp @@ -274,8 +274,7 @@ void reader_state::read_chunks(reader_t& s) if (sc.active) sc.delta << s; } - global_coords coord{ch, local_coords{i}}; - auto e = _world->make_entity<scenery>(oid, coord, sc); + auto e = _world->make_entity<scenery>(oid, {ch, local}, sc); c.add_entity_unsorted(e); break; } diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp index 3bfad5e1..9f724ef1 100644 --- a/serialize/world-writer.cpp +++ b/serialize/world-writer.cpp @@ -69,7 +69,7 @@ private: constexpr auto tile_size = sizeof(tilemeta) + (sizeof(atlasid) + sizeof(variant_t)) * 3 + sizeof(scenery); constexpr auto chunkbuf_size = sizeof(chunk_magic) + sizeof(chunk_coords) + tile_size * TILE_COUNT; -constexpr auto entity_size = std::max(sizeof(character), sizeof(scenery)); +constexpr auto entity_size = std::max(sizeof(character), sizeof(scenery)) + character_name_max; #ifdef __GNUG__ #pragma GCC diagnostic push @@ -302,7 +302,8 @@ const auto def_char_pass = character_proto{}.pass; void writer_state::serialize_chunk(const chunk& c, chunk_coords coord) { fm_assert(chunk_buf.empty()); - chunk_buf.resize(chunkbuf_size + sizeof(std::uint32_t) + entity_size*c.entities().size()); + const auto es_size = sizeof(std::uint32_t) + entity_size*c.entities().size(); + chunk_buf.resize(chunkbuf_size + es_size); auto s = binary_writer{chunk_buf.begin()}; @@ -347,7 +348,7 @@ void writer_state::serialize_chunk(const chunk& c, chunk_coords coord) { const auto& e = *e_; std::uint64_t oid = e.id; - fm_assert((oid & (1ULL << 60)-1) == oid); + fm_assert((oid & ((std::uint64_t)1 << 60)-1) == oid); static_assert(entity_type_BITS == 3); fm_assert(((entity_type_i)e.type & (1 << entity_type_BITS)-1) == (entity_type_i)e.type); oid |= (std::uint64_t)e.type << 64 - entity_type_BITS; |