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
|
|
@ -503,28 +503,27 @@ namespace Server.Engines.Doom
|
|||
/* I cant find any better way to send "speech" using fonts other than default */
|
||||
public static void POHMessage(Mobile from, int index)
|
||||
{
|
||||
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(Msgs[index])];
|
||||
buffer.InitializePacket();
|
||||
Span<byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLength(Msgs[index])].InitializePacket();
|
||||
|
||||
var eable = from.Map.GetClientsInRange(from.Location);
|
||||
|
||||
foreach (var state in eable)
|
||||
{
|
||||
if (buffer[0] == 0)
|
||||
{
|
||||
var length = OutgoingMessagePackets.CreateMessage(
|
||||
buffer,
|
||||
from.Serial,
|
||||
from.Body,
|
||||
MessageType.Regular,
|
||||
MsgParams[index][0],
|
||||
MsgParams[index][1],
|
||||
true,
|
||||
null,
|
||||
from.Name,
|
||||
Msgs[index]
|
||||
);
|
||||
var length = OutgoingMessagePackets.CreateMessage(
|
||||
buffer,
|
||||
from.Serial,
|
||||
from.Body,
|
||||
MessageType.Regular,
|
||||
MsgParams[index][0],
|
||||
MsgParams[index][1],
|
||||
true,
|
||||
null,
|
||||
from.Name,
|
||||
Msgs[index]
|
||||
);
|
||||
|
||||
if (length != buffer.Length)
|
||||
{
|
||||
buffer = buffer.Slice(0, length); // Adjust to the actual size
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue