From d76b8f23358be65174411253308d967d27226f29 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 5 May 2016 06:44:52 -0700 Subject: [PATCH] action->locallyAddedButNotYetReceived is unneeded with isMine available --- libraries/entities/src/EntityActionInterface.h | 2 -- libraries/entities/src/EntityItem.cpp | 14 ++++---------- libraries/physics/src/ObjectActionSpring.cpp | 2 -- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libraries/entities/src/EntityActionInterface.h b/libraries/entities/src/EntityActionInterface.h index c634326a31..34de87cca4 100644 --- a/libraries/entities/src/EntityActionInterface.h +++ b/libraries/entities/src/EntityActionInterface.h @@ -57,8 +57,6 @@ public: virtual bool isMine() { return _isMine; } virtual void setIsMine(bool value) { _isMine = value; } - bool locallyAddedButNotYetReceived = false; - virtual bool shouldSuppressLocationEdits() { return false; } virtual void prepareForPhysicsSimulation() { } diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 4bf7aefb7b..908e64708e 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1666,7 +1666,7 @@ bool EntityItem::addAction(EntitySimulation* simulation, EntityActionPointer act if (!result) { removeActionInternal(action->getID()); } else { - action->locallyAddedButNotYetReceived = true; + action->setIsMine(true); } }); @@ -1821,7 +1821,6 @@ void EntityItem::deserializeActionsInternal() { if (!action->isMine()) { action->deserialize(serializedAction); } - action->locallyAddedButNotYetReceived = false; updated << actionID; } else { auto actionFactory = DependencyManager::get(); @@ -1829,7 +1828,6 @@ void EntityItem::deserializeActionsInternal() { EntityActionPointer action = actionFactory->factoryBA(entity, serializedAction); if (action) { entity->addActionInternal(simulation, action); - action->locallyAddedButNotYetReceived = false; updated << actionID; } else { static QString repeatedMessage = @@ -1849,14 +1847,10 @@ void EntityItem::deserializeActionsInternal() { EntityActionPointer action = i.value(); if (action->isMine()) { - // we just received an update that didn't include one of our actions. tell the server about it. + // we just received an update that didn't include one of our actions. tell the server about it (again). setActionDataNeedsTransmit(true); - } - - // don't let someone else delete my action. - if (!action->isMine() && - // if we've just added this action, don't remove it due to lack of mention in an incoming packet. - !action->locallyAddedButNotYetReceived) { + } else { + // don't let someone else delete my action. _actionsToRemove << id; _previouslyDeletedActions.insert(id, now); } diff --git a/libraries/physics/src/ObjectActionSpring.cpp b/libraries/physics/src/ObjectActionSpring.cpp index 49944d6ed9..22b7ade979 100644 --- a/libraries/physics/src/ObjectActionSpring.cpp +++ b/libraries/physics/src/ObjectActionSpring.cpp @@ -139,13 +139,11 @@ void ObjectActionSpring::updateActionWorker(btScalar deltaTimeStep) { float speed = glm::min(offsetLength / _linearTimeScale, SPRING_MAX_SPEED); targetVelocity = (-speed / offsetLength) * offset; if (speed > rigidBody->getLinearSleepingThreshold()) { - qDebug() << "HERE"; forceBodyNonStatic(); rigidBody->activate(); } } // this action is aggresively critically damped and defeats the current velocity - qDebug() << targetVelocity.x() << targetVelocity.y() << targetVelocity.z(); rigidBody->setLinearVelocity(targetVelocity); }