|
|
@@ -187,11 +187,11 @@ class basic_registry {
|
|
|
if(destroyed == null) {
|
|
|
entt = entities.emplace_back(entity_type(entities.size()));
|
|
|
// traits_type::entity_mask is reserved to allow for null identifiers
|
|
|
- ENTT_ASSERT(to_integer(entt) < traits_type::entity_mask);
|
|
|
+ ENTT_ASSERT(to_integral(entt) < traits_type::entity_mask);
|
|
|
} else {
|
|
|
- const auto curr = to_integer(destroyed);
|
|
|
- const auto version = to_integer(entities[curr]) & (traits_type::version_mask << traits_type::entity_shift);
|
|
|
- destroyed = entity_type{to_integer(entities[curr]) & traits_type::entity_mask};
|
|
|
+ const auto curr = to_integral(destroyed);
|
|
|
+ const auto version = to_integral(entities[curr]) & (traits_type::version_mask << traits_type::entity_shift);
|
|
|
+ destroyed = entity_type{to_integral(entities[curr]) & traits_type::entity_mask};
|
|
|
entt = entity_type{curr | version};
|
|
|
entities[curr] = entt;
|
|
|
}
|
|
|
@@ -201,9 +201,9 @@ class basic_registry {
|
|
|
|
|
|
void release(const Entity entity) {
|
|
|
// lengthens the implicit list of destroyed entities
|
|
|
- const auto entt = to_integer(entity) & traits_type::entity_mask;
|
|
|
- const auto version = ((to_integer(entity) >> traits_type::entity_shift) + 1) << traits_type::entity_shift;
|
|
|
- const auto node = to_integer(destroyed) | version;
|
|
|
+ const auto entt = to_integral(entity) & traits_type::entity_mask;
|
|
|
+ const auto version = ((to_integral(entity) >> traits_type::entity_shift) + 1) << traits_type::entity_shift;
|
|
|
+ const auto node = to_integral(destroyed) | version;
|
|
|
entities[entt] = Entity{node};
|
|
|
destroyed = Entity{entt};
|
|
|
}
|
|
|
@@ -304,7 +304,7 @@ public:
|
|
|
auto curr = destroyed;
|
|
|
|
|
|
for(; curr != null; --sz) {
|
|
|
- curr = entities[to_integer(curr) & traits_type::entity_mask];
|
|
|
+ curr = entities[to_integral(curr) & traits_type::entity_mask];
|
|
|
}
|
|
|
|
|
|
return sz;
|
|
|
@@ -433,7 +433,7 @@ public:
|
|
|
* @return True if the identifier is valid, false otherwise.
|
|
|
*/
|
|
|
bool valid(const entity_type entity) const {
|
|
|
- const auto pos = size_type(to_integer(entity) & traits_type::entity_mask);
|
|
|
+ const auto pos = size_type(to_integral(entity) & traits_type::entity_mask);
|
|
|
return (pos < entities.size() && entities[pos] == entity);
|
|
|
}
|
|
|
|
|
|
@@ -443,7 +443,7 @@ public:
|
|
|
* @return The entity identifier without the version.
|
|
|
*/
|
|
|
static entity_type entity(const entity_type entity) ENTT_NOEXCEPT {
|
|
|
- return entity_type{to_integer(entity) & traits_type::entity_mask};
|
|
|
+ return entity_type{to_integral(entity) & traits_type::entity_mask};
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -452,7 +452,7 @@ public:
|
|
|
* @return The version stored along with the given entity identifier.
|
|
|
*/
|
|
|
static version_type version(const entity_type entity) ENTT_NOEXCEPT {
|
|
|
- return version_type(to_integer(entity) >> traits_type::entity_shift);
|
|
|
+ return version_type(to_integral(entity) >> traits_type::entity_shift);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -469,9 +469,9 @@ public:
|
|
|
* @return Actual version for the given entity identifier.
|
|
|
*/
|
|
|
version_type current(const entity_type entity) const {
|
|
|
- const auto pos = size_type(to_integer(entity) & traits_type::entity_mask);
|
|
|
+ const auto pos = size_type(to_integral(entity) & traits_type::entity_mask);
|
|
|
ENTT_ASSERT(pos < entities.size());
|
|
|
- return version_type(to_integer(entities[pos]) >> traits_type::entity_shift);
|
|
|
+ return version_type(to_integral(entities[pos]) >> traits_type::entity_shift);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -924,8 +924,8 @@ public:
|
|
|
} else {
|
|
|
for(auto pos = entities.size(); pos; --pos) {
|
|
|
const auto curr = entity_type(pos - 1);
|
|
|
- const auto entity = entities[to_integer(curr)];
|
|
|
- const auto entt = entity_type{to_integer(entity) & traits_type::entity_mask};
|
|
|
+ const auto entity = entities[to_integral(curr)];
|
|
|
+ const auto entt = entity_type{to_integral(entity) & traits_type::entity_mask};
|
|
|
|
|
|
if(curr == entt) {
|
|
|
func(entity);
|
|
|
@@ -1552,14 +1552,14 @@ public:
|
|
|
entt::basic_snapshot<Entity> snapshot() const {
|
|
|
using follow_fn_type = entity_type(const basic_registry &, const entity_type);
|
|
|
|
|
|
- const auto head = to_integer(destroyed);
|
|
|
- const entity_type seed = (destroyed == null) ? destroyed : entity_type{head | (to_integer(entities[head]) & (traits_type::version_mask << traits_type::entity_shift))};
|
|
|
+ const auto head = to_integral(destroyed);
|
|
|
+ const entity_type seed = (destroyed == null) ? destroyed : entity_type{head | (to_integral(entities[head]) & (traits_type::version_mask << traits_type::entity_shift))};
|
|
|
|
|
|
follow_fn_type *follow = [](const basic_registry ®, const entity_type entity) -> entity_type {
|
|
|
const auto &others = reg.entities;
|
|
|
- const auto entt = to_integer(entity) & traits_type::entity_mask;
|
|
|
- const auto curr = to_integer(others[entt]) & traits_type::entity_mask;
|
|
|
- return entity_type{curr | (to_integer(others[curr]) & (traits_type::version_mask << traits_type::entity_shift))};
|
|
|
+ const auto entt = to_integral(entity) & traits_type::entity_mask;
|
|
|
+ const auto curr = to_integral(others[entt]) & traits_type::entity_mask;
|
|
|
+ return entity_type{curr | (to_integral(others[curr]) & (traits_type::version_mask << traits_type::entity_shift))};
|
|
|
};
|
|
|
|
|
|
return { this, seed, follow };
|
|
|
@@ -1584,7 +1584,7 @@ public:
|
|
|
using force_fn_type = void(basic_registry &, const entity_type, const bool);
|
|
|
|
|
|
force_fn_type *force = [](basic_registry ®, const entity_type entity, const bool discard) {
|
|
|
- const auto entt = to_integer(entity) & traits_type::entity_mask;
|
|
|
+ const auto entt = to_integral(entity) & traits_type::entity_mask;
|
|
|
auto &others = reg.entities;
|
|
|
|
|
|
if(!(entt < others.size())) {
|
|
|
@@ -1600,8 +1600,8 @@ public:
|
|
|
|
|
|
if(discard) {
|
|
|
reg.destroy(entity);
|
|
|
- const auto version = to_integer(entity) & (traits_type::version_mask << traits_type::entity_shift);
|
|
|
- others[entt] = entity_type{(to_integer(others[entt]) & traits_type::entity_mask) | version};
|
|
|
+ const auto version = to_integral(entity) & (traits_type::version_mask << traits_type::entity_shift);
|
|
|
+ others[entt] = entity_type{(to_integral(others[entt]) & traits_type::entity_mask) | version};
|
|
|
}
|
|
|
};
|
|
|
|