add sanity check to PhysicalEntitySimulation::addAction

This commit is contained in:
Seth Alves 2015-06-26 16:55:16 -07:00
parent 31a3ca641d
commit 1326791502
2 changed files with 14 additions and 0 deletions

View file

@ -235,6 +235,19 @@ void PhysicalEntitySimulation::handleCollisionEvents(CollisionEvents& collisionE
}
}
void PhysicalEntitySimulation::addAction(EntityActionPointer action) {
if (_physicsEngine) {
lock();
const QUuid& actionID = action->getID();
if (_physicsEngine->getActionByID(actionID)) {
qDebug() << "warning -- PhysicalEntitySimulation::addAction -- adding an action that was already in _physicsEngine";
}
unlock();
EntitySimulation::addAction(action);
}
}
void PhysicalEntitySimulation::applyActionChanges() {
if (_physicsEngine) {
lock();

View file

@ -32,6 +32,7 @@ public:
void init(EntityTree* tree, PhysicsEngine* engine, EntityEditPacketSender* packetSender);
virtual void addAction(EntityActionPointer action);
virtual void applyActionChanges();
protected: // only called by EntitySimulation