You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
g_logger_assert(componentId < Internal::MaxNumComponents, "Exceeded the maximum number of components, you can increase this if needed.");
305
-
}
394
+
g_logger_assert(componentId < componentSets.size(), "You need to register all components in the same order *everywhere*. Component '%s' was not registered.", typeid(T).name());
if (componentId >= componentSets.size() || componentId < 0)
333
422
{
334
-
g_logger_warning("Tried to check if an entity had component '%d', but a component of type '%d' does not exist in the registry.", componentId, componentId);
423
+
g_logger_warning("Tried to check if an entity had component '%d', but a component of type '%d' does not exist in the registry which only has '%d' components.", componentId, componentId, componentSets.size());
g_logger_error("Cannot check if invalid entity %d has a component.", Internal::getEntityIndex(id));
435
+
returnnullptr;
436
+
}
437
+
438
+
if (componentId >= componentSets.size() || componentId < 0)
439
+
{
440
+
g_logger_warning("Tried to check if an entity had component '%d', but a component of type '%d' does not exist in the registry.", componentId, componentId);
g_logger_error("Cannot check if invalid entity %d has a component.", Internal::getEntityIndex(id));
452
+
returnnullptr;
453
+
}
454
+
455
+
if (componentId >= componentSets.size() || componentId < 0)
456
+
{
457
+
g_logger_warning("Tried to check if an entity had component '%d', but a component of type '%d' does not exist in the registry.", componentId, componentId);
458
+
returnnullptr;
459
+
}
460
+
461
+
return componentSets[componentId].addOrGet(id);
462
+
}
463
+
341
464
template<typename T>
342
465
T& getComponent(EntityId id)
343
466
{
344
467
const EntityIndex index = Internal::getEntityIndex(id);
345
468
int32 compId = Ecs::componentId<T>();
346
-
g_logger_assert(hasComponent<T>(id), "Entity '%d' does not have component '%d'", id, compId);
469
+
g_logger_assert(hasComponent<T>(id), "Entity '%d' does not have component '%s'", id, debugComponentNames[compId].c_str());
0 commit comments