diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-19 10:42:54 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-19 10:42:54 +0100 |
commit | 61d46a790cfde35bedf4283cbbcce06639cce1ec (patch) | |
tree | ffdbda2cb8fc4e47144aa25458e8191488cea478 /src/entity.cpp | |
parent | b93313e438c7b943e506f3c16675e5d38edd0537 (diff) |
src/entity: move type data member to vtable
Diffstat (limited to 'src/entity.cpp')
-rw-r--r-- | src/entity.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/entity.cpp b/src/entity.cpp index cc7bc00d..8822326e 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -13,14 +13,14 @@ entity_proto& entity_proto::operator=(const entity_proto&) = default; entity_proto::~entity_proto() noexcept = default; entity_proto::entity_proto() = default; entity_proto::entity_proto(const entity_proto&) = default; +entity_type entity_proto::type_of() const noexcept { return type; } -entity::entity(object_id id, struct chunk& c, entity_type type, const entity_proto& proto) : +entity::entity(object_id id, struct chunk& c, const entity_proto& proto) : id{id}, c{&c}, atlas{proto.atlas}, offset{proto.offset}, bbox_offset{proto.bbox_offset}, bbox_size{proto.bbox_size}, delta{proto.delta}, - frame{proto.frame}, type{type}, r{proto.r}, pass{proto.pass} + frame{proto.frame}, r{proto.r}, pass{proto.pass} { - fm_assert(type == proto.type); if (atlas) { fm_soft_assert(atlas->check_rotation(r)); @@ -60,7 +60,7 @@ float entity_proto::ordinal(local_coords local) const float entity::ordinal() const { - return ordinal(coord.local(), offset, type); + return ordinal(coord.local(), offset, type()); } float entity::ordinal(local_coords xy, Vector2b offset, entity_type type) @@ -181,7 +181,7 @@ size_t entity::move_to(size_t i, Vector2i delta, rotation new_r) const auto bb_size = rotate_size(bbox_size, r, new_r); bool b0 = c->_bbox_for_scenery(*this, bb0), b1 = c->_bbox_for_scenery(*this, coord_.local(), offset_, bb_offset, bb_size, bb1); - const auto ord = ordinal(coord_.local(), offset_, type); + const auto ord = ordinal(coord_.local(), offset_, type()); if (coord_.chunk() == coord.chunk()) { @@ -239,7 +239,7 @@ entity::operator entity_proto() const ret.bbox_size = bbox_size; ret.delta = delta; ret.frame = frame; - ret.type = type; + ret.type = type(); ret.r = r; ret.pass = pass; return ret; @@ -265,4 +265,9 @@ bool entity::is_dynamic() const return atlas->info().fps > 0; } +entity_type entity::type_of() const noexcept +{ + return type(); +} + } // namespace floormat |