History

Merge branch 'master' of github.com:highfidelity/hifi into polyvox

Seth Alves committed 11 years ago

Commit c80f2972 parents 0f81445 857552a69 files · +318 −306Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 69 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+11−10
@@ -79,7 +79,7 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties · 78 unmodified lines
7979 bool success = true;
8080 if (_entityTree) {
8181 _entityTree->lockForWrite();
82− EntityItem* entity = _entityTree->addEntity(id, propertiesWithSimID);
82+ EntityItemPointer entity = _entityTree->addEntity(id, propertiesWithSimID);
8383 if (entity) {
8484 entity->setLastBroadcast(usecTimestampNow());
8585 // This Node is creating a new object. If it's in motion, set this Node as the simulator.
@@ -103,7 +103,8 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit · 17 unmodified lines
103103 EntityItemProperties results;
104104 if (_entityTree) {
105105 _entityTree->lockForRead();
106− EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(EntityItemID(identity)));
106+
107+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(EntityItemID(identity));
107108
108109 if (entity) {
109110 results = entity->getProperties();
@@ -138,7 +139,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 28 unmodified lines
138139
139140 // make sure the properties has a type, so that the encode can know which properties to include
140141 if (properties.getType() == EntityTypes::Unknown) {
141− EntityItem* entity = _entityTree->findEntityByEntityItemID(entityID);
142+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
142143 if (entity) {
143144 // we need to change the outgoing properties, so we make a copy, modify, and send.
144145 EntityItemProperties modifiedProperties = properties;
@@ -162,7 +163,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { · 17 unmodified lines
162163 if (_entityTree) {
163164 _entityTree->lockForWrite();
164165
165− EntityItem* entity = const_cast<EntityItem*>(_entityTree->findEntityByEntityItemID(entityID));
166+ EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
166167 if (entity) {
167168 if (entity->getLocked()) {
168169 shouldDelete = false;
@@ -184,7 +185,7 @@ QUuid EntityScriptingInterface::findClosestEntity(const glm::vec3& center, float · 15 unmodified lines
184185 EntityItemID result;
185186 if (_entityTree) {
186187 _entityTree->lockForRead();
187− const EntityItem* closestEntity = _entityTree->findClosestEntity(center, radius);
188+ EntityItemPointer closestEntity = _entityTree->findClosestEntity(center, radius);
188189 _entityTree->unlock();
189190 if (closestEntity) {
190191 result = closestEntity->getEntityItemID();
@@ -206,11 +207,11 @@ QVector<QUuid> EntityScriptingInterface::findEntities(const glm::vec3& center, f · 15 unmodified lines
206207 QVector<QUuid> result;
207208 if (_entityTree) {
208209 _entityTree->lockForRead();
209− QVector<const EntityItem*> entities;
210+ QVector<EntityItemPointer> entities;
210211 _entityTree->findEntities(center, radius, entities);
211212 _entityTree->unlock();
212213
213− foreach (const EntityItem* entity, entities) {
214+ foreach (EntityItemPointer entity, entities) {
214215 result << entity->getEntityItemID();
215216 }
216217 }
@@ -222,11 +223,11 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corn · 5 unmodified lines
222223 if (_entityTree) {
223224 _entityTree->lockForRead();
224225 AABox box(corner, dimensions);
225− QVector<EntityItem*> entities;
226+ QVector<EntityItemPointer> entities;
226227 _entityTree->findEntities(box, entities);
227228 _entityTree->unlock();
228229
229− foreach (const EntityItem* entity, entities) {
230+ foreach (EntityItemPointer entity, entities) {
230231 result << entity->getEntityItemID();
231232 }
232233 }
@@ -249,7 +250,7 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke · 16 unmodified lines
249250 RayToEntityIntersectionResult result;
250251 if (_entityTree) {
251252 OctreeElement* element;
252− EntityItem* intersectedEntity = NULL;
253+ EntityItemPointer intersectedEntity = NULL;
253254 result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face,
254255 (void**)&intersectedEntity, lockType, &result.accurate,
255256 precisionPicking);