1
0
Эх сурвалжийг харах

registry: avoid bumping version on destroy if not requested

Michele Caini 2 жил өмнө
parent
commit
17f5b0a330

+ 8 - 1
src/entt/entity/registry.hpp

@@ -655,7 +655,14 @@ public:
      * @return The version of the recycled entity.
      */
     version_type destroy(const entity_type entt) {
-        return destroy(entt, traits_type::to_version(traits_type::next(entt)));
+        ENTT_ASSERT(!pools.empty() && (pools.begin()->second.get() == shortcut), "Misplaced entity pool");
+        ENTT_ASSERT(shortcut->contains(entt), "Invalid entity");
+
+        for(size_type pos = pools.size(); pos; --pos) {
+            pools.begin()[pos - 1u].second->remove(entt);
+        }
+
+        return shortcut->current(entt);
     }
 
     /**