MessagePacker.GetId<T> reuses GetId(Type)

This commit is contained in:
vis2k 2020-09-29 10:55:02 +02:00
parent aba69ca4d0
commit c947bc03e6

View File

@ -21,14 +21,14 @@ public static class MessagePacker
public static int GetId<T>() where T : IMessageBase
{
// paul: 16 bits is enough to avoid collisions
// - keeps the message size small because it gets varinted
// - in case of collisions, Mirror will display an error
return typeof(T).FullName.GetStableHashCode() & 0xFFFF;
return GetId(typeof(T));
}
public static int GetId(Type type)
{
// paul: 16 bits is enough to avoid collisions
// - keeps the message size small because it gets varinted
// - in case of collisions, Mirror will display an error
return type.FullName.GetStableHashCode() & 0xFFFF;
}