History

use smart pointers for entity simulations

Seth Alves committed 10 years ago

Commit a0771f81 parent b234d9423 files · +74 −58Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+7−7
@@ -766,7 +766,7 @@ bool EntityScriptingInterface::appendPoint(QUuid entityID, const glm::vec3& poin · 765 unmodified lines
766766
767767
768768 bool EntityScriptingInterface::actionWorker(const QUuid& entityID,
769− std::function<bool(EntitySimulation*, EntityItemPointer)> actor) {
769+ std::function<bool(EntitySimulationPointer, EntityItemPointer)> actor) {
770770 if (!_entityTree) {
771771 return false;
772772 }
@@ -774,7 +774,7 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID, · 1 unmodified line
774774 EntityItemPointer entity;
775775 bool doTransmit = false;
776776 _entityTree->withWriteLock([&] {
777− EntitySimulation* simulation = _entityTree->getSimulation();
777+ EntitySimulationPointer simulation = _entityTree->getSimulation();
778778 entity = _entityTree->findEntityByEntityItemID(entityID);
779779 if (!entity) {
780780 qDebug() << "actionWorker -- unknown entity" << entityID;
@@ -815,7 +815,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 34 unmodified lines
815815 QUuid actionID = QUuid::createUuid();
816816 auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
817817 bool success = false;
818− actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
818+ actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) {
819819 // create this action even if the entity doesn't have physics info. it will often be the
820820 // case that a script adds an action immediately after an object is created, and the physicsInfo
821821 // is computed asynchronously.
@@ -843,7 +843,7 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 21 unmodified lines
843843
844844
845845 bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& actionID, const QVariantMap& arguments) {
846− return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
846+ return actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) {
847847 bool success = entity->updateAction(simulation, actionID, arguments);
848848 if (success) {
849849 entity->grabSimulationOwnership();
@@ -854,7 +854,7 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 4 unmodified lines
854854
855855 bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) {
856856 bool success = false;
857− actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
857+ actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) {
858858 success = entity->removeAction(simulation, actionID);
859859 if (success) {
860860 // reduce from grab to poke
@@ -867,7 +867,7 @@ bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& · 6 unmodified lines
867867
868868 QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) {
869869 QVector<QUuid> result;
870− actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
870+ actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) {
871871 QList<QUuid> actionIDs = entity->getActionIDs();
872872 result = QVector<QUuid>::fromList(actionIDs);
873873 return false; // don't send an edit packet
@@ -877,7 +877,7 @@ QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) { · 3 unmodified lines
877877
878878 QVariantMap EntityScriptingInterface::getActionArguments(const QUuid& entityID, const QUuid& actionID) {
879879 QVariantMap result;
880− actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
880+ actionWorker(entityID, [&](EntitySimulationPointer simulation, EntityItemPointer entity) {
881881 result = entity->getActionArguments(actionID);
882882 return false; // don't send an edit packet
883883 });