From 6c4d232ad982a15c9dca39f07d61f54af6ac4aaf Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 15 Apr 2015 16:08:15 -0700 Subject: [PATCH] respond to code review --- .../entities-renderer/src/RenderableModelEntityItem.cpp | 4 ++-- libraries/entities/src/EntityTreeElement.cpp | 6 ++++-- libraries/entities/src/ModelEntityItem.cpp | 3 +-- libraries/entities/src/SimpleEntitySimulation.cpp | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index c67e1f04e5..86b0be4dd8 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -308,7 +308,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) { ShapeType type = getShapeType(); if (type != SHAPE_TYPE_COMPOUND) { ModelEntityItem::computeShapeInfo(info); - info.setParams(_shapeType, 0.5f * getDimensions()); + info.setParams(type, 0.5f * getDimensions()); } else { const QSharedPointer collisionNetworkGeometry = _model->getCollisionGeometry(); @@ -410,7 +410,7 @@ void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) { } glm::vec3 collisionModelDimensions = box.getDimensions(); - info.setParams(_shapeType, collisionModelDimensions, _collisionModelURL); + info.setParams(type, collisionModelDimensions, _collisionModelURL); info.setConvexHulls(_points); } } diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index c09b1701bc..3dcd2899d3 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -717,6 +717,10 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesRead += sizeof(numberOfEntities); if (bytesLeftToRead >= (int)(numberOfEntities * expectedBytesPerEntity)) { + // look up the Id of this Node + auto nodeList = DependencyManager::get(); + QString myNodeID = nodeList->getSessionUUID().toString(); + for (uint16_t i = 0; i < numberOfEntities; i++) { int bytesForThisEntity = 0; EntityItemID entityItemID; @@ -737,8 +741,6 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int // // TODO: Do we need to also do this? // 3) remember the old cube for the entity so we can mark it as dirty - auto nodeList = DependencyManager::get(); - QString myNodeID = nodeList->getSessionUUID().toString(); if (entityItem && entityItem->getSimulatorID() == myNodeID) { // do nothing, this was echoed back to us by the entity server } else if (entityItem) { diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index e98f784765..f95eeea8e4 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -296,8 +296,7 @@ void ModelEntityItem::updateShapeType(ShapeType type) { ShapeType ModelEntityItem::getShapeType() const { if (_shapeType == SHAPE_TYPE_COMPOUND) { return hasCollisionModel() ? SHAPE_TYPE_COMPOUND : SHAPE_TYPE_NONE; - } - else { + } else { return _shapeType; } } diff --git a/libraries/entities/src/SimpleEntitySimulation.cpp b/libraries/entities/src/SimpleEntitySimulation.cpp index 6846a38cb0..0406aaa443 100644 --- a/libraries/entities/src/SimpleEntitySimulation.cpp +++ b/libraries/entities/src/SimpleEntitySimulation.cpp @@ -15,7 +15,7 @@ #include "SimpleEntitySimulation.h" #include "EntitiesLogging.h" -const quint64 AUTO_REMOVE_SIMULATION_OWNER_USEC = 2000000; +const quint64 AUTO_REMOVE_SIMULATION_OWNER_USEC = 2 * USECS_PER_SECOND; void SimpleEntitySimulation::updateEntitiesInternal(const quint64& now) { // now is usecTimestampNow()