MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetObjectRole

Method GetObjectRole

Source/Engine/Networking/NetworkReplicator.cpp:1658–1688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1656}
1657
1658NetworkObjectRole NetworkReplicator::GetObjectRole(const ScriptingObject* obj)
1659{
1660 NetworkObjectRole role = NetworkObjectRole::None;
1661 if (obj && NetworkManager::IsConnected())
1662 {
1663 ScopeLock lock(ObjectsLock);
1664 const auto it = Objects.Find(obj->GetID());
1665 if (it != Objects.End())
1666 role = it->Item.Role;
1667 else
1668 {
1669 for (const SpawnItem& item : SpawnQueue)
1670 {
1671 if (item.Object == obj)
1672 {
1673 if (item.HasOwnership)
1674 role = item.Role;
1675#if USE_NETWORK_REPLICATOR_LOG
1676 return role;
1677#else
1678 break;
1679#endif
1680 }
1681 }
1682#if USE_NETWORK_REPLICATOR_LOG
1683 NETWORK_REPLICATOR_LOG(Error, "[NetworkReplicator] Failed to get ownership of unregistered network object {} ({})", obj->GetID(), obj->GetType().ToString());
1684#endif
1685 }
1686 }
1687 return role;
1688}
1689
1690void NetworkReplicator::SetObjectOwnership(ScriptingObject* obj, uint32 ownerClientId, NetworkObjectRole localRole, bool hierarchical)
1691{

Callers 1

InitializeMethod · 0.80

Calls 6

GetIDMethod · 0.80
IsConnectedFunction · 0.70
FindMethod · 0.45
EndMethod · 0.45
ToStringMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected