Add NetworkReplicator::MapObjectId for networked object identifies mapping

This commit is contained in:
Wojtek Figat
2024-09-18 12:54:10 +02:00
parent 8f0cf3b8ef
commit 8c0d89bc62
2 changed files with 11 additions and 0 deletions

View File

@@ -1302,6 +1302,11 @@ bool NetworkReplicator::HasObject(const ScriptingObject* obj)
return false; return false;
} }
void NetworkReplicator::MapObjectId(Guid& objectId)
{
IdsRemappingTable.TryGet(objectId, objectId);
}
ScriptingObject* NetworkReplicator::ResolveForeignObject(Guid objectId) ScriptingObject* NetworkReplicator::ResolveForeignObject(Guid objectId)
{ {
if (const auto& object = ResolveObject(objectId)) if (const auto& object = ResolveObject(objectId))

View File

@@ -116,6 +116,12 @@ public:
/// <param name="obj">The network object.</param> /// <param name="obj">The network object.</param>
/// <returns>True if object exists in networking, otherwise false.</returns> /// <returns>True if object exists in networking, otherwise false.</returns>
API_FUNCTION() static bool HasObject(const ScriptingObject* obj); API_FUNCTION() static bool HasObject(const ScriptingObject* obj);
/// <summary>
/// Maps object ID into server or client ID (depending on the source ID). Leaves source value unchanged if that specific ID is unused.
/// </summary>
/// <param name="objectId">The network object identifier to map. Contains result ID once the method completes.</param>
API_FUNCTION() static void MapObjectId(API_PARAM(Ref) Guid& objectId);
/// <summary> /// <summary>
/// Resolves foreign Guid into a local ScriptingObject /// Resolves foreign Guid into a local ScriptingObject