Add network messages to lookup dict in network server replace handler (#3753)

This commit is contained in:
Justin Nolan 2024-01-28 11:09:35 +01:00 committed by GitHub
parent 2c603fd406
commit 1c365fc3d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -928,6 +928,10 @@ public static void ReplaceHandler<T>(Action<NetworkConnectionToClient, T> handle
where T : struct, NetworkMessage
{
ushort msgType = NetworkMessageId<T>.Id;
// register Id <> Type in lookup for debugging.
NetworkMessages.Lookup[msgType] = typeof(T);
handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect);
}
@ -936,6 +940,10 @@ public static void ReplaceHandler<T>(Action<NetworkConnectionToClient, T, int> h
where T : struct, NetworkMessage
{
ushort msgType = NetworkMessageId<T>.Id;
// register Id <> Type in lookup for debugging.
NetworkMessages.Lookup[msgType] = typeof(T);
handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect);
}