remove redundant checks in 'if' clause

This commit is contained in:
Andrew Meadows 2019-11-13 15:28:16 -08:00
parent b231dadba5
commit b5ca93a019

View file

@ -3237,13 +3237,12 @@ void EntityItem::retrieveMarketplacePublicKey() {
void EntityItem::collectChildrenForDelete(std::vector<EntityItemPointer>& entitiesToDelete, const QUuid& sessionID) const {
// Deleting an entity has consequences for its children, however there are rules dictating what can be deleted.
// This method helps enforce those rules for the children of entity (not for this entity).
// This method helps enforce those rules: not for this entity, but for its children.
for (SpatiallyNestablePointer child : getChildren()) {
if (child && child->getNestableType() == NestableType::Entity) {
EntityItemPointer childEntity = std::static_pointer_cast<EntityItem>(child);
// NOTE: null sessionID means "collect ALL known entities", else we only collect: local-entities and authorized avatar-entities
if (sessionID.isNull() || childEntity->isLocalEntity() || (childEntity->isAvatarEntity() &&
(childEntity->isMyAvatarEntity() || childEntity->getOwningAvatarID() == sessionID))) {
// NOTE: null sessionID means "collect ALL known children", else we only collect: local-entities and myAvatar-entities
if (sessionID.isNull() || childEntity->isLocalEntity() || childEntity->isMyAvatarEntity()) {
if (std::find(entitiesToDelete.begin(), entitiesToDelete.end(), childEntity) == entitiesToDelete.end()) {
entitiesToDelete.push_back(childEntity);
childEntity->collectChildrenForDelete(entitiesToDelete, sessionID);
@ -3417,7 +3416,7 @@ void EntityItem::prepareForSimulationOwnershipBid(EntityItemProperties& properti
properties.setSimulationOwner(Physics::getSessionUUID(), priority);
setPendingOwnershipPriority(priority);
// ANDREW TODO: figure out if it would be OK to NOT bother set these properties here
// TODO: figure out if it would be OK to NOT bother set these properties here
properties.setEntityHostType(getEntityHostType());
properties.setOwningAvatarID(getOwningAvatarID());
setLastBroadcast(now); // for debug/physics status icons