Commit 40825f06 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Remove component from dictionary also

parent 6b2bc71b
......@@ -74,12 +74,12 @@ shared_ptr<Object> Object::getComponent(shared_ptr<string> identifier) {
return object;
}
/*! removeComponent - remove component by identifier*/
void Object::removeComponent(shared_ptr<string> identifier) {
components->removeObjectWithClassIdentifier(identifier);
}
/*! addComponent - add component*/
void Object::addComponent(shared_ptr<Object> component) {
if (component.get() == nullptr) {
......
......@@ -95,6 +95,8 @@ void Objects::removeObject(shared_ptr<Object> object) {
if (item->uuid.compare(object->uuid) == 0) {
shared_ptr<string> classIdentifier = object->getClassIdentifier();
classIdentifierToComponentMap.erase(*classIdentifier);
objects.erase(objects.begin() + index);
return;
}
......@@ -124,6 +126,11 @@ int Objects::size() {
void Objects::removeObjectAtIndex(unsigned int index) {
if (index < objects.size()) {
auto objectToRemove = objects[index];
shared_ptr<string> classIdentifier = objectToRemove->getClassIdentifier();
classIdentifierToComponentMap.erase(*classIdentifier);
objects.erase(objects.begin() + index);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment