minor changes
This commit is contained in:
@@ -72,8 +72,8 @@ class basic_registry {
|
||||
decltype(auto) assign(basic_registry ®istry, const Entity entt, Args &&... args) {
|
||||
if constexpr(std::is_empty_v<Component>) {
|
||||
storage<Entity, Component>::construct(entt);
|
||||
construction.publish(entt, registry, Component{std::forward<Args>(args)...});
|
||||
return Component{};
|
||||
construction.publish(entt, registry, Component{});
|
||||
return Component{std::forward<Args>(args)...};
|
||||
} else {
|
||||
auto &component = storage<Entity, Component>::construct(entt, std::forward<Args>(args)...);
|
||||
construction.publish(entt, registry, component);
|
||||
|
||||
@@ -135,25 +135,7 @@ public:
|
||||
*/
|
||||
template<typename... Component, typename Archive>
|
||||
const basic_snapshot & component(Archive &archive) const {
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
const auto sz = reg->template size<Component...>();
|
||||
const auto *entities = reg->template data<Component...>();
|
||||
|
||||
archive(typename traits_type::entity_type(sz));
|
||||
|
||||
for(std::remove_const_t<decltype(sz)> pos{}; pos < sz; ++pos) {
|
||||
const auto entt = entities[pos];
|
||||
|
||||
if constexpr(std::is_empty_v<Component...>) {
|
||||
archive(entt);
|
||||
} else {
|
||||
archive(entt, reg->template get<Component...>(entt));
|
||||
}
|
||||
};
|
||||
} else {
|
||||
(component<Component>(archive), ...);
|
||||
}
|
||||
|
||||
(component<Component>(archive, reg->template data<Component>(), reg->template data<Component>() + reg->template size<Component>()), ...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user