works, but removes an optimization we'd like to keep

This commit is contained in:
howard-stearns 2017-01-20 17:03:52 -08:00
parent c9c9b30c50
commit 7b986dcac6
2 changed files with 6 additions and 5 deletions

View file

@ -349,7 +349,6 @@ int EntityItem::expectedBytes() {
return MINIMUM_HEADER_BYTES; return MINIMUM_HEADER_BYTES;
} }
// clients use this method to unpack FULL updates from entity-server // clients use this method to unpack FULL updates from entity-server
int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args) { int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args) {
if (args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU) { if (args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU) {
@ -667,6 +666,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
// entity-server is trying to clear our ownership (probably at our own request) // entity-server is trying to clear our ownership (probably at our own request)
// but we actually want to own it, therefore we ignore this clear event // but we actually want to own it, therefore we ignore this clear event
// and pretend that we own it (we assume we'll recover it soon) // and pretend that we own it (we assume we'll recover it soon)
// However, for now, when the server uses a newer time than what we sent, listen to what we're told.
if (overwriteLocalData) weOwnSimulation = false;
} else if (_simulationOwner.set(newSimOwner)) { } else if (_simulationOwner.set(newSimOwner)) {
_dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID; _dirtyFlags |= Simulation::DIRTY_SIMULATOR_ID;
somethingChanged = true; somethingChanged = true;

View file

@ -952,7 +952,7 @@ bool EntityTree::filterProperties(EntityItemProperties& propertiesIn, EntityItem
wasChanged = in != out; wasChanged = in != out;
if (wasChanged) { if (wasChanged) {
// Logging will be removed eventually, but for now, the behavior is so fragile that it's worth logging. // Logging will be removed eventually, but for now, the behavior is so fragile that it's worth logging.
qCDebug(entities) << "filter accepted. changed:" << wasChanged; qCDebug(entities) << "filter accepted. changed: true";
qCDebug(entities) << " in:" << in; qCDebug(entities) << " in:" << in;
qCDebug(entities) << " out:" << out; qCDebug(entities) << " out:" << out;
} }
@ -1059,9 +1059,8 @@ int EntityTree::processEditPacketData(ReceivedMessage& message, const unsigned c
} }
if (!allowed || wasChanged) { if (!allowed || wasChanged) {
bumpTimestamp(properties); bumpTimestamp(properties);
if (properties.getSimulationOwner().getID() == senderNode->getUUID()) { // For now, free ownership on any modification.
properties.setSimulationOwner(QUuid(), 0); properties.clearSimulationOwner();
}
} }
endFilter = usecTimestampNow(); endFilter = usecTimestampNow();