Browse Source

bug fixing

Michele Caini 8 years ago
parent
commit
f0f8681455
1 changed files with 3 additions and 1 deletions
  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 {
         assert(lhs < 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]);
     }