From 3d6fbf38dba40c97d2a06cfe2cf344190d05cfe4 Mon Sep 17 00:00:00 2001 From: max-001 Date: Tue, 5 Nov 2024 14:26:41 +0100 Subject: Implemented -1 case --- src/crepe/ComponentManager.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/crepe') diff --git a/src/crepe/ComponentManager.hpp b/src/crepe/ComponentManager.hpp index 828ca8e..66e027f 100644 --- a/src/crepe/ComponentManager.hpp +++ b/src/crepe/ComponentManager.hpp @@ -33,7 +33,8 @@ T & ComponentManager::add_component(uint32_t id, Args &&... args) { T * instance = new T(id, forward(args)...); // Check if the vector size is not greater than get_instances_max - if (components[type][id].size() >= instance->get_instances_max()) { + if (instance->get_instances_max() != -1 + && components[type][id].size() >= instance->get_instances_max()) { throw std::runtime_error( "Exceeded maximum number of instances for this component type"); } -- cgit v1.2.3