Cleaning up the files updated

This commit is contained in:
samcake 2017-04-05 13:49:07 -07:00
parent 8356e5495f
commit 5629cf425e
6 changed files with 22 additions and 22 deletions

View file

@ -96,7 +96,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
if (motionState) {
if (!entity->shouldBePhysical()) {
// the entity should be removed from the physical simulation
_transaction.remove(motionState);
_pendingChanges.remove(motionState);
_physicalObjects.remove(motionState);
_outgoingChanges.remove(motionState);
_entitiesToRemoveFromPhysics.insert(entity);
@ -104,7 +104,7 @@ void PhysicalEntitySimulation::changeEntityInternal(EntityItemPointer entity) {
_simpleKinematicEntities.insert(entity);
}
} else {
_transaction.insert(motionState);
_pendingChanges.insert(motionState);
}
} else if (entity->shouldBePhysical()) {
// The intent is for this object to be in the PhysicsEngine, but it has no MotionState yet.
@ -148,7 +148,7 @@ void PhysicalEntitySimulation::clearEntitiesInternal() {
_entitiesToRemoveFromPhysics.clear();
_entitiesToRelease.clear();
_entitiesToAddToPhysics.clear();
_transaction.clear();
_pendingChanges.clear();
_outgoingChanges.clear();
}
@ -170,7 +170,7 @@ void PhysicalEntitySimulation::getObjectsToRemoveFromPhysics(VectorOfMotionState
EntityMotionState* motionState = static_cast<EntityMotionState*>(entity->getPhysicsInfo());
if (motionState) {
_transaction.remove(motionState);
_pendingChanges.remove(motionState);
_outgoingChanges.remove(motionState);
_physicalObjects.remove(motionState);
result.push_back(motionState);
@ -246,18 +246,18 @@ void PhysicalEntitySimulation::getObjectsToAddToPhysics(VectorOfMotionStates& re
void PhysicalEntitySimulation::setObjectsToChange(const VectorOfMotionStates& objectsToChange) {
QMutexLocker lock(&_mutex);
for (auto object : objectsToChange) {
_transaction.insert(static_cast<EntityMotionState*>(object));
_pendingChanges.insert(static_cast<EntityMotionState*>(object));
}
}
void PhysicalEntitySimulation::getObjectsToChange(VectorOfMotionStates& result) {
result.clear();
QMutexLocker lock(&_mutex);
for (auto stateItr : _transaction) {
for (auto stateItr : _pendingChanges) {
EntityMotionState* motionState = &(*stateItr);
result.push_back(motionState);
}
_transaction.clear();
_pendingChanges.clear();
}
void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotionStates& motionStates) {

View file

@ -67,7 +67,7 @@ private:
SetOfEntities _entitiesToRelease;
SetOfEntities _entitiesToAddToPhysics;
SetOfEntityMotionStates _transaction; // EntityMotionStates already in PhysicsEngine that need their physics changed
SetOfEntityMotionStates _pendingChanges; // EntityMotionStates already in PhysicsEngine that need their physics changed
SetOfEntityMotionStates _outgoingChanges; // EntityMotionStates for which we may need to send updates to entity-server
SetOfMotionStates _physicalObjects; // MotionStates of entities in PhysicsEngine

View file

@ -35,12 +35,12 @@ void Transaction::updateItem(ItemID id, const UpdateFunctorPointer& functor) {
_updateFunctors.push_back(functor);
}
void Transaction::merge(const Transaction& change) {
_resetItems.insert(_resetItems.end(), change._resetItems.begin(), change._resetItems.end());
_resetPayloads.insert(_resetPayloads.end(), change._resetPayloads.begin(), change._resetPayloads.end());
_removedItems.insert(_removedItems.end(), change._removedItems.begin(), change._removedItems.end());
_updatedItems.insert(_updatedItems.end(), change._updatedItems.begin(), change._updatedItems.end());
_updateFunctors.insert(_updateFunctors.end(), change._updateFunctors.begin(), change._updateFunctors.end());
void Transaction::merge(const Transaction& transaction) {
_resetItems.insert(_resetItems.end(), transaction._resetItems.begin(), transaction._resetItems.end());
_resetPayloads.insert(_resetPayloads.end(), transaction._resetPayloads.begin(), transaction._resetPayloads.end());
_removedItems.insert(_removedItems.end(), transaction._removedItems.begin(), transaction._removedItems.end());
_updatedItems.insert(_updatedItems.end(), transaction._updatedItems.begin(), transaction._updatedItems.end());
_updateFunctors.insert(_updateFunctors.end(), transaction._updateFunctors.begin(), transaction._updateFunctors.end());
}
Scene::Scene(glm::vec3 origin, float size) :

View file

@ -34,7 +34,7 @@ public:
void updateItem(ItemID id, const UpdateFunctorPointer& functor);
void updateItem(ItemID id) { updateItem(id, nullptr); }
void merge(const Transaction& change);
void merge(const Transaction& transaction);
ItemIDs _resetItems;
Payloads _resetPayloads;

View file

@ -53,8 +53,8 @@ namespace Setting {
const auto& key = handle->getKey();
withWriteLock([&] {
QVariant loadedValue;
if (_transaction.contains(key) && _transaction[key] != UNSET_VALUE) {
loadedValue = _transaction[key];
if (_pendingChanges.contains(key) && _pendingChanges[key] != UNSET_VALUE) {
loadedValue = _pendingChanges[key];
} else {
loadedValue = value(key);
}
@ -73,7 +73,7 @@ namespace Setting {
}
withWriteLock([&] {
_transaction[key] = handleValue;
_pendingChanges[key] = handleValue;
});
}
@ -98,8 +98,8 @@ namespace Setting {
void Manager::saveAll() {
bool forceSync = false;
withWriteLock([&] {
for (auto key : _transaction.keys()) {
auto newValue = _transaction[key];
for (auto key : _pendingChanges.keys()) {
auto newValue = _pendingChanges[key];
auto savedValue = value(key, UNSET_VALUE);
if (newValue == savedValue) {
continue;
@ -112,7 +112,7 @@ namespace Setting {
setValue(key, newValue);
}
}
_transaction.clear();
_pendingChanges.clear();
});
if (forceSync) {

View file

@ -47,7 +47,7 @@ namespace Setting {
QHash<QString, Interface*> _handles;
QPointer<QTimer> _saveTimer = nullptr;
const QVariant UNSET_VALUE { QUuid::createUuid() };
QHash<QString, QVariant> _transaction;
QHash<QString, QVariant> _pendingChanges;
friend class Interface;
friend void cleanupPrivateInstance();