Fix initializing ecs species components
This commit is contained in:
parent
07804bdeda
commit
b00a74f431
1 changed files with 5 additions and 4 deletions
|
|
@ -304,9 +304,10 @@ namespace psemek::util
|
||||||
struct species_impl_base
|
struct species_impl_base
|
||||||
: species_base
|
: species_base
|
||||||
{
|
{
|
||||||
species_impl_base(ecs * ecs, std::string name, species_handle id, Components && ... components)
|
template <typename ... Args>
|
||||||
|
species_impl_base(ecs * ecs, std::string name, species_handle id, Args && ... components)
|
||||||
: species_base(ecs, std::move(name), id)
|
: species_base(ecs, std::move(name), id)
|
||||||
, species_components_{std::move(components)...}
|
, species_components_{std::forward<Args>(components)...}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
using species_base::get_species_component;
|
using species_base::get_species_component;
|
||||||
|
|
@ -720,9 +721,9 @@ namespace psemek::util
|
||||||
{
|
{
|
||||||
species_handle result{species_.size()};
|
species_handle result{species_.size()};
|
||||||
if (p == policy::sparse)
|
if (p == policy::sparse)
|
||||||
species_.push_back(std::make_unique<ecs_detail::sparse_species_impl<Components...>>(this, std::move(name), result.value, std::move(components)...));
|
species_.push_back(std::make_unique<ecs_detail::sparse_species_impl<std::remove_cvref_t<Components>...>>(this, std::move(name), result.value, std::forward<Components>(components)...));
|
||||||
else
|
else
|
||||||
species_.push_back(std::make_unique<ecs_detail::packed_species_impl<Components...>>(this, std::move(name), result.value, std::move(components)...));
|
species_.push_back(std::make_unique<ecs_detail::packed_species_impl<std::remove_cvref_t<Components>...>>(this, std::move(name), result.value, std::forward<Components>(components)...));
|
||||||
for (auto const & ctor : species_constructors_)
|
for (auto const & ctor : species_constructors_)
|
||||||
ctor(result);
|
ctor(result);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue