From 31b833b46a38f48cfbab2eaacfca676ab6530dda Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 31 Mar 2019 16:08:00 +0200 Subject: [PATCH] minor changes --- src/entt/entity/registry.hpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index 6bc796972..8b4051b7c 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -635,9 +635,7 @@ public: ENTT_ASSERT(valid(entity)); for(auto pos = pools.size(); pos; --pos) { - auto &pdata = pools[pos-1]; - - if(pdata.pool && pdata.pool->has(entity)) { + if(auto &pdata = pools[pos-1]; pdata.pool && pdata.pool->has(entity)) { pdata.pool->destroy(entity); } }; @@ -658,9 +656,7 @@ public: ENTT_ASSERT(std::all_of(first, last, [this](const auto entity) { return valid(entity); })); for(auto pos = pools.size(); pos; --pos) { - auto &pdata = pools[pos-1]; - - if(pdata.pool) { + if(auto &pdata = pools[pos-1]; pdata.pool) { std::for_each(first, last, [&pdata](const auto entity) { if(pdata.pool->has(entity)) { pdata.pool->destroy(entity); @@ -1103,9 +1099,8 @@ public: template void reset(const entity_type entity) { ENTT_ASSERT(valid(entity)); - auto *cpool = assure(); - if(cpool->has(entity)) { + if(auto *cpool = assure(); cpool->has(entity)) { cpool->destroy(entity); } } @@ -1120,9 +1115,7 @@ public: */ template void reset() { - auto *cpool = assure(); - - if(cpool->on_destroy.empty()) { + if(auto *cpool = assure(); cpool->on_destroy.empty()) { // no group set, otherwise the signal wouldn't be empty cpool->reset(); } else { @@ -1497,9 +1490,7 @@ public: other.pools.resize(pools.size()); for(auto pos = pools.size(); pos; --pos) { - auto &pdata = pools[pos-1]; - - if(pdata.pool && (!sizeof...(Component) || ... || (pdata.runtime_type == type()))) { + if(auto &pdata = pools[pos-1]; pdata.pool && (!sizeof...(Component) || ... || (pdata.runtime_type == type()))) { auto &curr = other.pools[pos-1]; curr.pool = pdata.pool->clone(); curr.runtime_type = pdata.runtime_type;