summaryrefslogtreecommitdiffhomepage
path: root/serialize
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-09-01 22:36:26 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-09-01 22:36:26 +0200
commitd90c38ce59d406cdfd4303c836ee524a71ad0979 (patch)
tree27c7bae59fbea84529977f588f050d5ce09e14ea /serialize
parent31fd5bbc08234686cf798a93a18e0bb73615d1bf (diff)
rename character -> critter
Diffstat (limited to 'serialize')
-rw-r--r--serialize/world-impl.hpp2
-rw-r--r--serialize/world-reader.cpp14
-rw-r--r--serialize/world-writer.cpp16
3 files changed, 16 insertions, 16 deletions
diff --git a/serialize/world-impl.hpp b/serialize/world-impl.hpp
index b01e81ba..f01276be 100644
--- a/serialize/world-impl.hpp
+++ b/serialize/world-impl.hpp
@@ -54,7 +54,7 @@ constexpr inline proto_t proto_version = 16;
constexpr inline size_t atlas_name_max = 128;
constexpr inline auto null_atlas = (atlasid)-1LL;
-constexpr inline size_t character_name_max = 128;
+constexpr inline size_t critter_name_max = 128;
constexpr inline size_t string_max = 512;
constexpr inline proto_t min_proto_version = 1;
diff --git a/serialize/world-reader.cpp b/serialize/world-reader.cpp
index 769dda20..53b675ea 100644
--- a/serialize/world-reader.cpp
+++ b/serialize/world-reader.cpp
@@ -3,7 +3,7 @@
#include "binary-reader.inl"
#include "src/world.hpp"
#include "src/scenery.hpp"
-#include "src/character.hpp"
+#include "src/critter.hpp"
#include "src/light.hpp"
#include "loader/loader.hpp"
#include "loader/scenery.hpp"
@@ -77,7 +77,7 @@ bool read_object_flags(binary_reader<T>& s, U& e)
e.closing = !!(flags & 1 << 3);
e.interactive = !!(flags & 1 << 4);
}
- else if constexpr(tag == object_type::character)
+ else if constexpr(tag == object_type::critter)
{
e.playable = !!(flags & 1 << 2);
}
@@ -259,8 +259,8 @@ void reader_state::read_chunks(reader_t& s)
SET_CHUNK_SIZE();
switch (type)
{
- case object_type::character: {
- character_proto proto;
+ case object_type::critter: {
+ critter_proto proto;
proto.offset = offset;
uint8_t id; id << s;
proto.r = rotation(id >> sizeof(id)*8-1-rotation_BITS & rotation_MASK);
@@ -278,12 +278,12 @@ void reader_state::read_chunks(reader_t& s)
{
uint32_t id; id << s;
auto name = lookup_string(id);
- fm_soft_assert(name.size() < character_name_max);
+ fm_soft_assert(name.size() < critter_name_max);
proto.name = name;
}
else
{
- auto [buf, len] = s.read_asciiz_string<character_name_max>();
+ auto [buf, len] = s.read_asciiz_string<critter_name_max>();
auto name = StringView{buf, len};
proto.name = name;
}
@@ -297,7 +297,7 @@ void reader_state::read_chunks(reader_t& s)
read_bbox(s, proto);
}
SET_CHUNK_SIZE();
- auto e = _world->make_object<character, false>(oid, {ch, local}, proto);
+ auto e = _world->make_object<critter, false>(oid, {ch, local}, proto);
e->offset_frac = offset_frac;
(void)e;
break;
diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp
index 6d32762f..fedf96d6 100644
--- a/serialize/world-writer.cpp
+++ b/serialize/world-writer.cpp
@@ -9,7 +9,7 @@
#include "src/emplacer.hpp"
#include "loader/loader.hpp"
#include "src/scenery.hpp"
-#include "src/character.hpp"
+#include "src/critter.hpp"
#include "loader/scenery.hpp"
#include "src/anim-atlas.hpp"
#include "src/light.hpp"
@@ -77,7 +77,7 @@ private:
constexpr auto tile_size = sizeof(tilemeta) + (sizeof(atlasid) + sizeof(variant_t)) * 3;
constexpr auto chunkbuf_size = sizeof(chunk_magic) + sizeof(chunk_coords_) + tile_size * TILE_COUNT + sizeof(uint32_t);
-constexpr auto object_size = std::max({ sizeof(character), sizeof(scenery), sizeof(light), });
+constexpr auto object_size = std::max({ sizeof(critter), sizeof(scenery), sizeof(light), });
writer_state::writer_state(const world& world) : _world{&world}
{
@@ -194,7 +194,7 @@ void write_object_flags(binary_writer<T>& s, const U& e)
flags |= (1 << 3) * e.closing;
flags |= (1 << 4) * e.interactive;
}
- else if constexpr(tag == object_type::character)
+ else if constexpr(tag == object_type::critter)
{
flags |= (1 << 2) * e.playable;
}
@@ -299,7 +299,7 @@ void writer_state::serialize_scenery_names()
void writer_state::serialize_strings()
{
- static_assert(character_name_max <= string_max);
+ static_assert(critter_name_max <= string_max);
auto len = 0uz;
for (const auto& [k, v] : string_map)
{
@@ -351,8 +351,8 @@ void writer_state::serialize_scenery(const chunk& c, writer_t& s)
{
default:
fm_abort("invalid object type '%d'", (int)type);
- case object_type::character: {
- const auto& C = static_cast<const character&>(e);
+ case object_type::critter: {
+ const auto& C = static_cast<const critter&>(e);
uint8_t id = 0;
const auto sc_exact =
C.bbox_offset.isZero() &&
@@ -367,7 +367,7 @@ void writer_state::serialize_scenery(const chunk& c, writer_t& s)
s << C.frame;
s << C.offset_frac[0];
s << C.offset_frac[1];
- fm_assert(C.name.size() < character_name_max);
+ fm_assert(C.name.size() < critter_name_max);
s << intern_string(C.name);
if (!sc_exact)
write_bbox(s, C);
@@ -542,7 +542,7 @@ ArrayView<const char> writer_state::serialize_world()
case object_type::scenery:
intern_scenery(static_cast<const scenery&>(e), false);
break;
- case object_type::character:
+ case object_type::critter:
case object_type::light:
break;
default: