fix: Updates encoded packet handler to use function pointers (#1066)

This commit is contained in:
Kamron Batman 2022-06-15 17:20:36 -07:00 committed by GitHub
parent f24b98f8e2
commit 057cf87e60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 54 deletions

View file

@ -35,7 +35,9 @@ public static class IncomingPackets
public static PacketHandler GetHandler(int packetID) => Handlers[packetID];
public static void RegisterEncoded(int packetID, bool ingame, OnEncodedPacketReceive onReceive)
public static unsafe void RegisterEncoded(
int packetID, bool ingame, delegate*<NetState, IEntity, EncodedReader, void> onReceive
)
{
if (packetID is >= 0 and < 0x100)
{

View file

@ -48,8 +48,8 @@ public static class IncomingPlayerPackets
IncomingPackets.Register(0xD7, 0, true, &EncodedCommand);
IncomingPackets.Register(0xF4, 0, false, &CrashReport);
IncomingPackets.RegisterEncoded(0x28, true, GuildGumpRequest);
IncomingPackets.RegisterEncoded(0x32, true, QuestGumpRequest);
IncomingPackets.RegisterEncoded(0x28, true, &GuildGumpRequest);
IncomingPackets.RegisterEncoded(0x32, true, &QuestGumpRequest);
}
public static void DeathStatusResponse(NetState state, CircularBufferReader reader, int packetLength)
@ -593,7 +593,7 @@ public static class IncomingPlayerPackets
EventSink.InvokeQuestGumpRequest(state.Mobile);
}
public static void EncodedCommand(NetState state, CircularBufferReader reader, int packetLength)
public static unsafe void EncodedCommand(NetState state, CircularBufferReader reader, int packetLength)
{
var e = World.FindEntity((Serial)reader.ReadUInt32());
int packetId = reader.ReadUInt16();