Clears the user data cache when syncUserData is called.

Adds unit test for the UserData functons.
Changes the char pointer in btHashString to std::string. There were
problems where the object owning the string memory would deallocate the
string, making the btHashString object invalid.
This commit is contained in:
Tigran Gasparian
2018-06-04 15:10:48 +02:00
parent e0667d8579
commit bb72a91080
4 changed files with 259 additions and 2 deletions

View File

@@ -1385,6 +1385,15 @@ 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)
{
(*bodyJointsPtr)->m_jointToUserDataMap.clear();
}
}
const int numIdentifiers = serverCmd.m_syncUserDataArgs.m_numUserDataIdentifiers;
if (numIdentifiers > 0) {
m_data->m_tempBackupServerStatus = m_data->m_lastServerStatus;