mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:16:56 +02:00
when ignoring an incoming packet, still read it so the data-stream pointer doesn't get screwed up
This commit is contained in:
parent
639b9ef9ff
commit
f77038c52d
3 changed files with 9 additions and 10 deletions
|
@ -312,7 +312,8 @@ int EntityItem::expectedBytes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args) {
|
int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args,
|
||||||
|
bool ignoreServerPacket) {
|
||||||
|
|
||||||
if (args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU) {
|
if (args.bitstreamVersion < VERSION_ENTITIES_SUPPORT_SPLIT_MTU) {
|
||||||
|
|
||||||
|
@ -421,8 +422,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
||||||
qCDebug(entities) << " fromSameServerEdit:" << fromSameServerEdit;
|
qCDebug(entities) << " fromSameServerEdit:" << fromSameServerEdit;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ignoreServerPacket = false; // assume we'll use this server packet
|
|
||||||
|
|
||||||
// If this packet is from the same server edit as the last packet we accepted from the server
|
// If this packet is from the same server edit as the last packet we accepted from the server
|
||||||
// we probably want to use it.
|
// we probably want to use it.
|
||||||
if (fromSameServerEdit) {
|
if (fromSameServerEdit) {
|
||||||
|
|
|
@ -113,7 +113,8 @@ public:
|
||||||
static EntityItemID readEntityItemIDFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
static EntityItemID readEntityItemIDFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args);
|
ReadBitstreamToTreeParams& args);
|
||||||
|
|
||||||
virtual int readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args);
|
virtual int readEntityDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args,
|
||||||
|
bool ignoreServerPacket = false);
|
||||||
|
|
||||||
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
virtual int readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args,
|
ReadBitstreamToTreeParams& args,
|
||||||
|
|
|
@ -696,7 +696,6 @@ bool EntityTreeElement::removeEntityItem(EntityItem* entity) {
|
||||||
// and dirty path marking in one pass.
|
// and dirty path marking in one pass.
|
||||||
int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||||
ReadBitstreamToTreeParams& args) {
|
ReadBitstreamToTreeParams& args) {
|
||||||
|
|
||||||
// If we're the root, but this bitstream doesn't support root elements with data, then
|
// If we're the root, but this bitstream doesn't support root elements with data, then
|
||||||
// return without reading any bytes
|
// return without reading any bytes
|
||||||
if (this == _myTree->getRoot() && args.bitstreamVersion < VERSION_ROOT_ELEMENT_HAS_DATA) {
|
if (this == _myTree->getRoot() && args.bitstreamVersion < VERSION_ROOT_ELEMENT_HAS_DATA) {
|
||||||
|
@ -735,20 +734,20 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the item already exists in our tree, we want do the following...
|
// If the item already exists in our tree, we want do the following...
|
||||||
// 0) if this node is the simulator for the entity, ignore the update packet
|
|
||||||
// 1) allow the existing item to read from the databuffer
|
// 1) allow the existing item to read from the databuffer
|
||||||
// 2) check to see if after reading the item, the containing element is still correct, fix it if needed
|
// 2) check to see if after reading the item, the containing element is still correct, fix it if needed
|
||||||
//
|
//
|
||||||
// TODO: Do we need to also do this?
|
// TODO: Do we need to also do this?
|
||||||
// 3) remember the old cube for the entity so we can mark it as dirty
|
// 3) remember the old cube for the entity so we can mark it as dirty
|
||||||
if (entityItem && entityItem->getSimulatorID() == myNodeID) {
|
if (entityItem) {
|
||||||
// do nothing, this was echoed back to us by the entity server
|
|
||||||
} else if (entityItem) {
|
|
||||||
QString entityScriptBefore = entityItem->getScript();
|
QString entityScriptBefore = entityItem->getScript();
|
||||||
bool bestFitBefore = bestFitEntityBounds(entityItem);
|
bool bestFitBefore = bestFitEntityBounds(entityItem);
|
||||||
EntityTreeElement* currentContainingElement = _myTree->getContainingElement(entityItemID);
|
EntityTreeElement* currentContainingElement = _myTree->getContainingElement(entityItemID);
|
||||||
|
|
||||||
bytesForThisEntity = entityItem->readEntityDataFromBuffer(dataAt, bytesLeftToRead, args);
|
// this Node was the original source of this packet, so read it, but ignore it.
|
||||||
|
bool shouldIgnore = (entityItem && entityItem->getSimulatorID() == myNodeID);
|
||||||
|
|
||||||
|
bytesForThisEntity = entityItem->readEntityDataFromBuffer(dataAt, bytesLeftToRead, args, shouldIgnore);
|
||||||
if (entityItem->getDirtyFlags()) {
|
if (entityItem->getDirtyFlags()) {
|
||||||
_myTree->entityChanged(entityItem);
|
_myTree->entityChanged(entityItem);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue