From d7394a8369e09197991ecf8b3c800cd151f7c66d Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Fri, 8 Jun 2018 23:03:05 +0200 Subject: [PATCH] more on prototype --- src/entt/entity/prototype.hpp | 18 ++++++------------ test/entt/entity/prototype.cpp | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/entt/entity/prototype.hpp b/src/entt/entity/prototype.hpp index 795c20694..c61a6b02c 100644 --- a/src/entt/entity/prototype.hpp +++ b/src/entt/entity/prototype.hpp @@ -279,10 +279,8 @@ public: * * @return A valid entity identifier. */ - entity_type create() const { - const auto entity = registry->create(); - assign(*registry, entity); - return entity; + inline entity_type create() const { + return create(*registry); } /** @@ -332,10 +330,8 @@ public: * * @param dst A valid entity identifier. */ - void assign(const entity_type dst) const { - for(auto &handler: handlers) { - handler.second.assign(*this, *registry, dst); - } + inline void assign(const entity_type dst) const { + assign(*registry, dst); } /** @@ -381,10 +377,8 @@ public: * * @param dst A valid entity identifier. */ - void accommodate(const entity_type dst) const { - for(auto &handler: handlers) { - handler.second.accommodate(*this, *registry, dst); - } + inline void accommodate(const entity_type dst) const { + accommodate(*registry, dst); } /** diff --git a/test/entt/entity/prototype.cpp b/test/entt/entity/prototype.cpp index 8e11f83c8..b6cf9f071 100644 --- a/test/entt/entity/prototype.cpp +++ b/test/entt/entity/prototype.cpp @@ -19,7 +19,7 @@ TEST(Prototype, SameRegistry) { ASSERT_EQ(std::get<0>(prototype.get()), 3); ASSERT_EQ(std::get<1>(cprototype.get()), 'c'); - const auto e0 = prototype(); + const auto e0 = prototype.create(); ASSERT_TRUE((prototype.has())); ASSERT_FALSE(registry.orphan(e0)); @@ -79,7 +79,7 @@ TEST(Prototype, OtherRegistry) { ASSERT_EQ(std::get<0>(prototype.get()), 3); ASSERT_EQ(std::get<1>(cprototype.get()), 'c'); - const auto e0 = prototype(registry); + const auto e0 = prototype.create(registry); ASSERT_TRUE((prototype.has())); ASSERT_FALSE(registry.orphan(e0));