fix: Fixes thread guard and cleans up incoming packet reader (#1641)

### Summary
* Fixes syntax compile error when THREADGUARD is enabled.
* Removes `int packetLength` from incoming packet handles since they aren't needed.

### Developer Notes
Incoming packet handler `SpanReader` is now properly scoped to that packet by length.
This commit is contained in:
Kamron Batman 2023-12-19 17:04:09 -08:00 • committed by GitHub
parent 25a75fdf24
commit 7d9bc9ff0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 190 additions and 157 deletions

View file

@ -31,7 +31,7 @@ public static class IncomingItemPackets
IncomingPackets.Register(0xED, 0, false, &UnequipMacro);
}
public static void LiftReq(NetState state, SpanReader reader, int packetLength)
public static void LiftReq(NetState state, SpanReader reader)
{
var serial = (Serial)reader.ReadUInt32();
int amount = reader.ReadUInt16();
@ -40,7 +40,7 @@ public static class IncomingItemPackets
state.Mobile.Lift(item, amount, out _, out _);
}
public static void EquipReq(NetState state, SpanReader reader, int packetLength)
public static void EquipReq(NetState state, SpanReader reader)
{
var from = state.Mobile;
var item = from.Holding;
@ -65,7 +65,7 @@ public static class IncomingItemPackets
item.ClearBounce();
}
public static void DropReq(NetState state, SpanReader reader, int packetLength)
public static void DropReq(NetState state, SpanReader reader)
{
reader.ReadInt32(); // serial, ignored
int x = reader.ReadInt16();
@ -108,7 +108,7 @@ public static class IncomingItemPackets
}
}
public static void EquipMacro(NetState state, SpanReader reader, int packetLength)
public static void EquipMacro(NetState state, SpanReader reader)
{
int count = reader.ReadByte();
var serialList = new List<Serial>(count);
@ -120,7 +120,7 @@ public static class IncomingItemPackets
EventSink.InvokeEquipMacro(state.Mobile, serialList);
}
public static void UnequipMacro(NetState state, SpanReader reader, int packetLength)
public static void UnequipMacro(NetState state, SpanReader reader)
{
int count = reader.ReadByte();
var layers = new List<Layer>(count);