mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 12:02:48 +02:00
Fix processOctreeStats recreating JurisdictionMap for every stat packet
This commit is contained in:
parent
013d902376
commit
47d897f669
1 changed files with 15 additions and 9 deletions
|
@ -4372,8 +4372,11 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer
|
||||||
serverType = "Entity";
|
serverType = "Entity";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
jurisdiction->withReadLock([&] {
|
jurisdiction->withReadLock([&] {
|
||||||
if (jurisdiction->find(nodeUUID) != jurisdiction->end()) {
|
if (jurisdiction->find(nodeUUID) != jurisdiction->end()) {
|
||||||
|
found = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4384,15 +4387,18 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer
|
||||||
qPrintable(serverType),
|
qPrintable(serverType),
|
||||||
(double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
|
(double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
|
||||||
});
|
});
|
||||||
// store jurisdiction details for later use
|
|
||||||
// This is bit of fiddling is because JurisdictionMap assumes it is the owner of the values used to construct it
|
if (!found) {
|
||||||
// but OctreeSceneStats thinks it's just returning a reference to its contents. So we need to make a copy of the
|
// store jurisdiction details for later use
|
||||||
// details from the OctreeSceneStats to construct the JurisdictionMap
|
// This is bit of fiddling is because JurisdictionMap assumes it is the owner of the values used to construct it
|
||||||
JurisdictionMap jurisdictionMap;
|
// but OctreeSceneStats thinks it's just returning a reference to its contents. So we need to make a copy of the
|
||||||
jurisdictionMap.copyContents(octreeStats.getJurisdictionRoot(), octreeStats.getJurisdictionEndNodes());
|
// details from the OctreeSceneStats to construct the JurisdictionMap
|
||||||
jurisdiction->withWriteLock([&] {
|
JurisdictionMap jurisdictionMap;
|
||||||
(*jurisdiction)[nodeUUID] = jurisdictionMap;
|
jurisdictionMap.copyContents(octreeStats.getJurisdictionRoot(), octreeStats.getJurisdictionEndNodes());
|
||||||
});
|
jurisdiction->withWriteLock([&] {
|
||||||
|
(*jurisdiction)[nodeUUID] = jurisdictionMap;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return statsMessageLength;
|
return statsMessageLength;
|
||||||
|
|
Loading…
Reference in a new issue