mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 00:49:08 +02:00
allow for removal and readdition of an action in one time-slice without asserting
This commit is contained in:
parent
3e88e1f400
commit
c539d9f233
2 changed files with 4 additions and 20 deletions
|
@ -263,22 +263,6 @@ void EntitySimulation::moveSimpleKinematics(const quint64& now) {
|
|||
|
||||
void EntitySimulation::addAction(EntityActionPointer action) {
|
||||
lock();
|
||||
|
||||
#if DEBUG
|
||||
foreach (EntityActionPointer actionToAdd, _actionsToAdd) {
|
||||
if (actionToAdd->getID() == action->getID()) {
|
||||
qDebug() << "action added to add-list more than once";
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
foreach (QUuid actionToRemoveID, _actionsToRemove) {
|
||||
if (actionToRemoveID == action->getID()) {
|
||||
qDebug() << "action added to add-list and remove-list";
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
_actionsToAdd += action;
|
||||
unlock();
|
||||
}
|
||||
|
|
|
@ -251,16 +251,16 @@ void PhysicalEntitySimulation::addAction(EntityActionPointer action) {
|
|||
void PhysicalEntitySimulation::applyActionChanges() {
|
||||
if (_physicsEngine) {
|
||||
lock();
|
||||
foreach (QUuid actionToRemove, _actionsToRemove) {
|
||||
_physicsEngine->removeAction(actionToRemove);
|
||||
}
|
||||
_actionsToRemove.clear();
|
||||
foreach (EntityActionPointer actionToAdd, _actionsToAdd) {
|
||||
if (!_actionsToRemove.contains(actionToAdd->getID())) {
|
||||
_physicsEngine->addAction(actionToAdd);
|
||||
}
|
||||
}
|
||||
_actionsToAdd.clear();
|
||||
foreach (QUuid actionToRemove, _actionsToRemove) {
|
||||
_physicsEngine->removeAction(actionToRemove);
|
||||
}
|
||||
_actionsToRemove.clear();
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue