Fix replication regression from eb2fc0f02f

This commit is contained in:
Wojtek Figat
2023-05-24 11:52:32 +02:00
parent c4f57d19db
commit 2c1f6e561a

View File

@@ -1436,10 +1436,9 @@ void NetworkInternal::NetworkReplicatorUpdate()
// Skip serialization of objects that none will receive // Skip serialization of objects that none will receive
if (!isClient) if (!isClient)
{ {
// TODO: per-object relevancy for connected clients (eg. skip replicating actor to far players)
BuildCachedTargets(item, e.TargetClients); BuildCachedTargets(item, e.TargetClients);
if (CachedTargets.Count() == 0) if (CachedTargets.Count() == 0)
return; continue;
} }
if (item.AsNetworkObject) if (item.AsNetworkObject)
@@ -1451,11 +1450,10 @@ void NetworkInternal::NetworkReplicatorUpdate()
if (failed) if (failed)
{ {
//NETWORK_REPLICATOR_LOG(Error, "[NetworkReplicator] Cannot serialize object {} of type {} (missing serialization logic)", item.ToString(), obj->GetType().ToString()); //NETWORK_REPLICATOR_LOG(Error, "[NetworkReplicator] Cannot serialize object {} of type {} (missing serialization logic)", item.ToString(), obj->GetType().ToString());
return; continue;
} }
// Send object to clients // Send object to clients
{
const uint32 size = stream->GetPosition(); const uint32 size = stream->GetPosition();
ASSERT(size <= MAX_uint16) ASSERT(size <= MAX_uint16)
NetworkMessageObjectReplicate msgData; NetworkMessageObjectReplicate msgData;
@@ -1520,7 +1518,6 @@ void NetworkInternal::NetworkReplicatorUpdate()
// TODO: stats for bytes send per object type // TODO: stats for bytes send per object type
} }
} }
}
// Invoke RPCs // Invoke RPCs
{ {