Fixed network replicated-object deduplication by hashing/equality on ObjectId

Aligned NetworkReplicatedObject equality with its hash (compare ObjectId, not pointer).
This commit is contained in:
Michael Herzog
2025-11-27 22:54:43 +01:00
parent a1999183f2
commit 56beca0db4

View File

@@ -152,12 +152,12 @@ struct NetworkReplicatedObject
bool operator==(const NetworkReplicatedObject& other) const bool operator==(const NetworkReplicatedObject& other) const
{ {
return Object == other.Object; return ObjectId == other.ObjectId;
} }
bool operator==(const ScriptingObject* other) const bool operator==(const ScriptingObject* other) const
{ {
return Object == other; return other && ObjectId == other->GetID();
} }
bool operator==(const Guid& other) const bool operator==(const Guid& other) const
@@ -176,6 +176,11 @@ inline uint32 GetHash(const NetworkReplicatedObject& key)
return GetHash(key.ObjectId); return GetHash(key.ObjectId);
} }
inline uint32 GetHash(const ScriptingObject* key)
{
return key ? GetHash(key->GetID()) : 0;
}
struct Serializer struct Serializer
{ {
NetworkReplicator::SerializeFunc Methods[2]; NetworkReplicator::SerializeFunc Methods[2];