Ver Fonte

bug fixing

Michele Caini há 8 anos atrás
pai
commit
f0f8681455
1 ficheiros alterados com 3 adições e 1 exclusões
  1. 3 1
      src/entt/entity/sparse_set.hpp

+ 3 - 1
src/entt/entity/sparse_set.hpp

@@ -306,7 +306,9 @@ public:
     void swap(pos_type lhs, pos_type rhs) noexcept {
     void swap(pos_type lhs, pos_type rhs) noexcept {
         assert(lhs < direct.size());
         assert(lhs < direct.size());
         assert(rhs < direct.size());
         assert(rhs < direct.size());
-        std::swap(reverse[direct[lhs]], reverse[direct[rhs]]);
+        const auto src = direct[lhs] & traits_type::entity_mask;
+        const auto dst = direct[rhs] & traits_type::entity_mask;
+        std::swap(reverse[src], reverse[dst]);
         std::swap(direct[lhs], direct[rhs]);
         std::swap(direct[lhs], direct[rhs]);
     }
     }