History

add priority promotion to reduce volunteer races

also fix priority inheritance from chained collisions

Andrew Meadows committed 11 years ago

Commit 4d4b97f1 parent f2749589 files · +26 −46Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 9 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+5−3
@@ -161,9 +161,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties proper · 160 unmodified lines
161161 // proxy toward the true physical position" feature to hide the final glitches in the remote watcher's
162162 // simulation.
163163
164− // we re-assert our simulation ownership
165− properties.setSimulationOwner(myNodeID,
166− glm::max(entity->getSimulationPriority(), SCRIPT_EDIT_SIMULATION_PRIORITY));
164+ if (entity->getSimulationPriority() < SCRIPT_EDIT_SIMULATION_PRIORITY) {
165+ // we re-assert our simulation ownership at a higher priority
166+ properties.setSimulationOwner(myNodeID,
167+ glm::max(entity->getSimulationPriority(), SCRIPT_EDIT_SIMULATION_PRIORITY));
168+ }
167169 } else {
168170 // we make a bid for simulation ownership
169171 properties.setSimulationOwner(myNodeID, SCRIPT_EDIT_SIMULATION_PRIORITY);