@@ -60,12 +60,7 @@ class ComponentArray : public IComponentArray {
6060 size--;
6161 }
6262
63- T* getData (Entity entity) {
64- assert (entityToIndexMap.find (entity) != entityToIndexMap.end () && " Retrieving non-existent component." );
65-
66- // Return a reference to the entity's component
67- return &(componentArray[entityToIndexMap[entity]]);
68- }
63+ T* getData (Entity entity) { return &(componentArray[entityToIndexMap[entity]]); }
6964
7065 void entityDestroyed (Entity entity) override {
7166 if (entityToIndexMap.find (entity) != entityToIndexMap.end ()) {
@@ -112,9 +107,6 @@ class ComponentManager {
112107 template <typename T>
113108 ComponentType getComponentType () const {
114109 auto const & type = typeid (T);
115-
116- assert (componentTypes.find (type) != componentTypes.end () && " Component not registered before use." );
117-
118110 // Return this component's type - used for creating signatures
119111 return componentTypes.at (type);
120112 }
@@ -127,8 +119,7 @@ class ComponentManager {
127119
128120 template <typename T>
129121 void removeComponent (Entity entity) {
130- // Remove a component from the array for an entity
131- getComponentArray<T>()->removeData (entity);
122+ getComponentArray<T>()->removeData (entity);
132123 }
133124
134125 template <typename T>
@@ -161,9 +152,6 @@ class ComponentManager {
161152 template <typename T>
162153 std::shared_ptr<ComponentArray<T>> getComponentArray () {
163154 auto const & type = typeid (T);
164-
165- assert (componentTypes.find (type) != componentTypes.end () && " Component not registered before use." );
166-
167155 return std::static_pointer_cast<ComponentArray<T>>(componentArrays[type]);
168156 }
169157};
0 commit comments