Only clear the user data cache when a full user data sync is requested.

This commit is contained in:
Tigran Gasparian
2020-02-03 15:24:12 +01:00
parent 9469f39b3e
commit 19075f75b2
5 changed files with 26 additions and 17 deletions

View File

@@ -1585,17 +1585,19 @@ const SharedMemoryStatus* PhysicsClientSharedMemory::processServerStatus()
if (serverCmd.m_type == CMD_SYNC_USER_DATA_COMPLETED)
{
B3_PROFILE("CMD_SYNC_USER_DATA_COMPLETED");
// Remove all cached user data entries.
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
{
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
if (bodyJointsPtr && *bodyJointsPtr)
if (serverCmd.m_syncUserDataArgs.m_clearCachedUserDataEntries) {
// Remove all cached user data entries.
for (int i = 0; i < m_data->m_bodyJointMap.size(); i++)
{
(*bodyJointsPtr)->m_userDataIds.clear();
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap.getAtIndex(i);
if (bodyJointsPtr && *bodyJointsPtr)
{
(*bodyJointsPtr)->m_userDataIds.clear();
}
}
m_data->m_userDataMap.clear();
m_data->m_userDataHandleLookup.clear();
}
m_data->m_userDataMap.clear();
m_data->m_userDataHandleLookup.clear();
const int numIdentifiers = serverCmd.m_syncUserDataArgs.m_numUserDataIdentifiers;
if (numIdentifiers > 0)
{