snapshot: again, dense_map::contains is a thing

This commit is contained in:
Michele Caini
2023-06-06 10:18:22 +02:00
parent afb70d1570
commit 63b300d39d

View File

@@ -319,18 +319,16 @@ class basic_continuous_loader {
using traits_type = typename Registry::traits_type;
void restore(typename Registry::entity_type entt) {
const auto it = remloc.find(entt);
if(it == remloc.cend()) {
const auto local = reg->create();
remloc.emplace(entt, std::make_pair(local, true));
} else {
if(remloc.contains(entt)) {
if(!reg->valid(remloc[entt].first)) {
remloc[entt].first = reg->create();
}
// set the dirty flag
remloc[entt].second = true;
} else {
const auto local = reg->create();
remloc.emplace(entt, std::make_pair(local, true));
}
}
@@ -437,7 +435,7 @@ public:
for(std::size_t pos = in_use; pos < length; ++pos) {
archive(entt);
if(const auto it = remloc.find(entt); it == remloc.cend()) {
if(!remloc.contains(entt)) {
const auto local = storage.emplace();
remloc.emplace(entt, std::make_pair(local, true));
storage.erase(local);