diff --git a/src/entt/entity/observer.hpp b/src/entt/entity/observer.hpp index 1ab040e92..1307f602c 100644 --- a/src/entt/entity/observer.hpp +++ b/src/entt/entity/observer.hpp @@ -190,7 +190,7 @@ class basic_observer { template static void discard_if(basic_observer &obs, const basic_registry &, const Entity entt) { if(auto *value = obs.view.try_get(entt); value && !(*value &= (~(1 << Index)))) { - obs.view.destroy(entt); + obs.view.erase(entt); } } @@ -226,7 +226,7 @@ class basic_observer { template static void discard_if(basic_observer &obs, const basic_registry &, const Entity entt) { if(auto *value = obs.view.try_get(entt); value && !(*value &= (~(1 << Index)))) { - obs.view.destroy(entt); + obs.view.erase(entt); } } diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 638c8951f..2bc435072 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -82,7 +82,7 @@ class basic_registry { void remove(basic_registry &owner, const Entity entt) { destruction.publish(owner, entt); - this->destroy(entt); + this->erase(entt); } template @@ -160,7 +160,7 @@ class basic_registry { void discard_if([[maybe_unused]] basic_registry &owner, const Entity entt) { if constexpr(sizeof...(Owned) == 0) { if(current.contains(entt)) { - current.destroy(entt); + current.erase(entt); } } else { if(const auto cpools = std::forward_as_tuple(owner.assure()...); std::get<0>(cpools).contains(entt) && (std::get<0>(cpools).index(entt) < current)) { diff --git a/src/entt/entity/sparse_set.hpp b/src/entt/entity/sparse_set.hpp index 1d04a630c..a63b8c72c 100644 --- a/src/entt/entity/sparse_set.hpp +++ b/src/entt/entity/sparse_set.hpp @@ -427,7 +427,7 @@ public: * * @param entt A valid entity identifier. */ - void destroy(const entity_type entt) { + void erase(const entity_type entt) { ENTT_ASSERT(contains(entt)); const auto curr = page(entt); const auto pos = offset(entt); @@ -437,6 +437,12 @@ public: direct.pop_back(); } + /*! @copydoc erase */ + [[deprecated("use ::erase instead")]] + void destroy(const entity_type entt) { + erase(entt); + } + /** * @brief Swaps two entities in the internal packed array. * diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index fa639e88f..5eacf1887 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -404,11 +404,17 @@ public: * * @param entt A valid entity identifier. */ - void destroy(const entity_type entt) { + void erase(const entity_type entt) { auto other = std::move(instances.back()); instances[underlying_type::index(entt)] = std::move(other); instances.pop_back(); - underlying_type::destroy(entt); + underlying_type::erase(entt); + } + + /*! @copydoc erase */ + [[deprecated("use ::erase instead")]] + void destroy(const entity_type entt) { + erase(entt); } /**