From 7c793c6397837f384348f3208b06b625b1ed221d Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Mon, 15 Jun 2015 10:58:14 -0700 Subject: [PATCH] accept simulation release from entity-server --- libraries/entities/src/EntityItem.cpp | 10 ++++++---- libraries/physics/src/EntityMotionState.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index b3c7f47b4f..82a843ff48 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -124,6 +124,7 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param requestedProperties += PROP_USER_DATA; requestedProperties += PROP_MARKETPLACE_ID; requestedProperties += PROP_NAME; + requestedProperties += PROP_SIMULATOR_PRIORITY; requestedProperties += PROP_SIMULATOR_ID; requestedProperties += PROP_HREF; requestedProperties += PROP_DESCRIPTION; @@ -599,16 +600,17 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef auto nodeList = DependencyManager::get(); if (_simulatorID == nodeList->getSessionUUID()) { // we think we're the simulation owner but entity-server says otherwise - // we relenquish ownership iff the incoming priority is greater than or equal to ours - // AND we don't have max priority - if (priority >= _simulatorPriority && _simulatorPriority != MAX_SIMULATOR_PRIORITY) { + // we relenquish ownership only if we don't have MAX_SIMULATOR_PRIORITY + if (_simulatorPriority != MAX_SIMULATOR_PRIORITY) { // we're losing simulation ownership _simulatorID = id; _simulatorPriority = priority; + _dirtyFlags |= EntityItem::DIRTY_SIMULATOR_ID; } } else { _simulatorID = id; _simulatorPriority = priority; + _dirtyFlags |= EntityItem::DIRTY_SIMULATOR_ID; } } else if (priority != _simulatorPriority) { // priority is changing but simulatorID is not. @@ -967,8 +969,8 @@ EntityItemProperties EntityItem::getProperties() const { COPY_ENTITY_PROPERTY_TO_PROPERTIES(collisionsWillMove, getCollisionsWillMove); COPY_ENTITY_PROPERTY_TO_PROPERTIES(locked, getLocked); COPY_ENTITY_PROPERTY_TO_PROPERTIES(userData, getUserData); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulatorID, getSimulatorID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulatorPriority, getSimulatorPriority); + COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulatorID, getSimulatorID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(marketplaceID, getMarketplaceID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(name, getName); COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref); diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 9a65bac042..246acd2efb 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -101,7 +101,7 @@ void EntityMotionState::handleEasyChanges(uint32_t flags) { if (flags & EntityItem::DIRTY_SIMULATOR_ID) { _loopsSinceOwnershipBid = 0; _loopsWithoutOwner = 0; - _candidateForOwnership = 0; + _candidateForOwnership = false; if (_entity->getSimulatorID().isNull() && !_entity->isMoving() && _body->isActive()) {