diff --git a/headers/ecs.hpp/ecs.hpp b/headers/ecs.hpp/ecs.hpp index b0738bb..c2dfec7 100644 --- a/headers/ecs.hpp/ecs.hpp +++ b/headers/ecs.hpp/ecs.hpp @@ -1914,7 +1914,7 @@ namespace ecs_hpp auto applier = std::make_unique( std::make_tuple(std::forward(args)...)); const auto family = detail::type_family::id(); - appliers_.emplace(family, std::move(applier)); + appliers_.insert_or_assign(family, std::move(applier)); return *this; } diff --git a/untests/ecs_tests.cpp b/untests/ecs_tests.cpp index c32e5c5..8fd31c5 100644 --- a/untests/ecs_tests.cpp +++ b/untests/ecs_tests.cpp @@ -586,6 +586,15 @@ TEST_CASE("registry") { REQUIRE(e2.component_count() == 1u); REQUIRE(e2.get_component() == position_c(1,2)); } + { + ecs::prototype p; + p.component(1, 2); + p.component(11, 22); + + ecs::registry w; + const auto e1 = w.create_entity(p); + REQUIRE(e1.get_component() == position_c(11,22)); + } { const auto p = ecs::prototype() .component(1,2)