fix(core): Cleans up uninitialized packets (#397)
- [X] Encapsulates/abstracts buffer cache checking - [X] Changes mobile moving cache to use Span2D
This commit is contained in:
parent
0b9fb9c071
commit
8763be8a21
18 changed files with 417 additions and 529 deletions
|
|
@ -416,18 +416,13 @@ namespace Server.Commands
|
|||
toAll
|
||||
);
|
||||
|
||||
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength];
|
||||
buffer.InitializePacket();
|
||||
Span<byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength].InitializePacket();
|
||||
|
||||
foreach (var state in m.GetClientsInRange(12))
|
||||
{
|
||||
if (toAll || state.Mobile.CanSee(m))
|
||||
{
|
||||
if (buffer[0] == 0)
|
||||
{
|
||||
OutgoingEffectPackets.CreateSoundEffect(buffer, index, m);
|
||||
}
|
||||
|
||||
OutgoingEffectPackets.CreateSoundEffect(buffer, index, m);
|
||||
state.Send(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,8 +69,7 @@ namespace Server.Commands
|
|||
|
||||
if (list.Count > 0)
|
||||
{
|
||||
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength];
|
||||
removeEntity.InitializePacket();
|
||||
Span<byte> removeEntity = stackalloc byte[OutgoingEntityPackets.RemoveEntityLength].InitializePacket();
|
||||
|
||||
for (var i = 0; i < list.Count; ++i)
|
||||
{
|
||||
|
|
@ -78,11 +77,7 @@ namespace Server.Commands
|
|||
|
||||
if (!m.CanSee(pm) && Utility.InUpdateRange(m, pm))
|
||||
{
|
||||
if (removeEntity[0] == 0)
|
||||
{
|
||||
OutgoingEntityPackets.CreateRemoveEntity(removeEntity, pm.Serial);
|
||||
}
|
||||
|
||||
OutgoingEntityPackets.CreateRemoveEntity(removeEntity, pm.Serial);
|
||||
m.NetState?.Send(removeEntity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue