static Component* findDragAndDropTarget (Component* c, const ComponentPeer::DragInfo& info, Component* lastOne) { for (; c != nullptr; c = c->getParentComponent()) if (isSuitableTarget (info, c) && (c == lastOne || isInterested (info, c))) return c; return nullptr; }
void EntitySystem::check(EntityPtr e) { assert(e != NULL); bool doesContain = contains(e); bool isInterestedInEntity = isInterested(e); // If the EntitySystem IS interested in the component // and DOES NOT contain the Entity already if (isInterestedInEntity && !doesContain) { // add it to the system insert(e); } // otherwise if the EntitySystem isn't interested in the component // and it does contain the Entity, remove it. // i.e. this EntitySystem no longer wants the Entity else if (!isInterestedInEntity && doesContain) { // remove it from the system remove(e); } }