aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/ComponentManager.hpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-11-05 14:26:41 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-11-05 14:26:41 +0100
commit3d6fbf38dba40c97d2a06cfe2cf344190d05cfe4 (patch)
tree6957a65e4e34793b64e3f9d74ac49668e04ea7f2 /src/crepe/ComponentManager.hpp
parentdd24187ba7bcd534a54b723735168f45e9612051 (diff)
Implemented -1 case
Diffstat (limited to 'src/crepe/ComponentManager.hpp')
-rw-r--r--src/crepe/ComponentManager.hpp3
1 files changed, 2 insertions, 1 deletions
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>(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");
}