mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Don't delete sequence numbers outside of range as range may change
This commit is contained in:
parent
a8b9568c92
commit
3c665b7de8
4 changed files with 24 additions and 12 deletions
|
@ -5495,7 +5495,6 @@ void Application::update(float deltaTime) {
|
|||
if (!_physicsEnabled) {
|
||||
if (!domainLoadingInProgress) {
|
||||
PROFILE_ASYNC_BEGIN(app, "Scene Loading", "");
|
||||
_octreeProcessor.startEntitySequence();
|
||||
domainLoadingInProgress = true;
|
||||
}
|
||||
|
||||
|
@ -5514,7 +5513,7 @@ void Application::update(float deltaTime) {
|
|||
// process octree stats packets are sent in between full sends of a scene (this isn't currently true).
|
||||
// We keep physics disabled until we've received a full scene and everything near the avatar in that
|
||||
// scene is ready to compute its collision shape.
|
||||
if (nearbyEntitiesAreReadyForPhysics() && getMyAvatar()->isReadyForPhysics()) {
|
||||
if (getMyAvatar()->isReadyForPhysics()) {
|
||||
_physicsEnabled = true;
|
||||
getMyAvatar()->updateMotionBehaviorFromMenu();
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ void SafeLanding::deleteTrackedEntity(const EntityItemID& entityID) {
|
|||
void SafeLanding::setCompletionSequenceNumbers(int first, int last) {
|
||||
Locker lock(_lock);
|
||||
_initialStart = first;
|
||||
_initialEnd = (last + 1) % SEQUENCE_MODULO;
|
||||
_initialEnd = last;
|
||||
}
|
||||
|
||||
void SafeLanding::sequenceNumberReceived(int sequenceNumber) {
|
||||
|
@ -96,7 +96,7 @@ void SafeLanding::sequenceNumberReceived(int sequenceNumber) {
|
|||
}
|
||||
|
||||
bool SafeLanding::isLoadSequenceComplete() {
|
||||
if (sequenceNumbersComplete() && entityPhysicsComplete()) {
|
||||
if (entityPhysicsComplete() && sequenceNumbersComplete()) {
|
||||
Locker lock(_lock);
|
||||
_trackingEntities = false;
|
||||
_trackedEntities.clear();
|
||||
|
@ -109,14 +109,19 @@ bool SafeLanding::isLoadSequenceComplete() {
|
|||
bool SafeLanding::sequenceNumbersComplete() {
|
||||
if (_initialStart != INVALID_SEQUENCE) {
|
||||
Locker lock(_lock);
|
||||
auto startIter = _sequenceNumbers.find(_initialStart);
|
||||
if (startIter != _sequenceNumbers.end()) {
|
||||
_sequenceNumbers.erase(_sequenceNumbers.begin(), startIter);
|
||||
_sequenceNumbers.erase(_sequenceNumbers.find(_initialEnd), _sequenceNumbers.end());
|
||||
int sequenceSize = _initialStart < _initialEnd ? _initialEnd - _initialStart :
|
||||
//auto startIter = _sequenceNumbers.find(_initialStart);
|
||||
//if (startIter != _sequenceNumbers.end()) {
|
||||
// _sequenceNumbers.erase(_sequenceNumbers.begin(), startIter);
|
||||
// _sequenceNumbers.erase(_sequenceNumbers.find(_initialEnd), _sequenceNumbers.end());
|
||||
int sequenceSize = _initialStart < _initialEnd ? _initialEnd - _initialStart:
|
||||
_initialEnd + SEQUENCE_MODULO - _initialStart;
|
||||
// First no. exists, nothing outside of first, last exists, so complete iff set size is sequence size.
|
||||
return (int) _sequenceNumbers.size() == sequenceSize;
|
||||
// // First no. exists, nothing outside of first, last exists, so complete iff set size is sequence size.
|
||||
// return (int) _sequenceNumbers.size() == sequenceSize;
|
||||
//}
|
||||
auto startIter = _sequenceNumbers.find(_initialStart);
|
||||
auto endIter = _sequenceNumbers.find(_initialEnd);
|
||||
if (startIter != _sequenceNumbers.end() && endIter != _sequenceNumbers.end() && std::distance(startIter, endIter) == sequenceSize) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
|
||||
static constexpr int INVALID_SEQUENCE = -1;
|
||||
int _initialStart { INVALID_SEQUENCE };
|
||||
int _initialEnd { INVALID_SEQUENCE }; // final sequence, exclusive.
|
||||
int _initialEnd { INVALID_SEQUENCE };
|
||||
|
||||
struct SequenceLessThan {
|
||||
bool operator()(const int& a, const int& b) const;
|
||||
|
|
|
@ -642,6 +642,14 @@ bool EntityTreeRenderer::applyLayeredZones() {
|
|||
}
|
||||
|
||||
void EntityTreeRenderer::processEraseMessage(ReceivedMessage& message, const SharedNodePointer& sourceNode) {
|
||||
OCTREE_PACKET_FLAGS flags;
|
||||
message.readPrimitive(&flags);
|
||||
|
||||
OCTREE_PACKET_SEQUENCE sequence;
|
||||
message.readPrimitive(&sequence);
|
||||
|
||||
_lastOctreeMessageSequence = sequence;
|
||||
message.seek(0);
|
||||
std::static_pointer_cast<EntityTree>(_tree)->processEraseMessage(message, sourceNode);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue