diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-15 14:52:54 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-15 15:09:09 +0100 |
commit | 2e0c0009806860e4e8ac24663afdc5d926d1213f (patch) | |
tree | 24a88dfa818e52179b0955a463da4b9cfa834b4d /src/entity.hpp | |
parent | c6c3c887e99c57fb567252053190ce4a24f65455 (diff) |
src: add O(1) chunk access from entity
Diffstat (limited to 'src/entity.hpp')
-rw-r--r-- | src/entity.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/entity.hpp b/src/entity.hpp index 18c588bd..34aec0af 100644 --- a/src/entity.hpp +++ b/src/entity.hpp @@ -11,6 +11,7 @@ namespace floormat { template<typename T> struct entity_type_; struct anim_atlas; struct world; +struct chunk; enum class entity_type : std::uint8_t { none, character, scenery, @@ -41,7 +42,7 @@ struct entity using It = typename std::vector<std::shared_ptr<entity>>::const_iterator; const std::uint64_t id = 0; - world& w; + struct chunk& c; std::shared_ptr<anim_atlas> atlas; global_coords coord; Vector2b offset, bbox_offset; @@ -73,8 +74,8 @@ struct entity friend struct world; protected: - entity(std::uint64_t id, struct world& w, entity_type type) noexcept; - entity(std::uint64_t id, struct world& w, entity_type type, const entity_proto& proto) noexcept; + entity(std::uint64_t id, struct chunk& c, entity_type type) noexcept; + entity(std::uint64_t id, struct chunk& c, entity_type type, const entity_proto& proto) noexcept; }; } // namespace floormat |