fix: Cleans up mobile status packets (#835)

* Removes Span2D for mobile moving. Instead uses pure math and simplifies the calculation.
* Cleans up the extended mobile status packet.
This commit is contained in:
Kamron Batman 2022-02-27 03:10:35 -08:00 committed by GitHub
parent e873d2ed7e
commit 651cffa872
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 47 deletions

View file

@ -17,7 +17,6 @@ using System;
using System.Buffers;
using System.IO;
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance;
namespace Server.Network
{
@ -55,12 +54,12 @@ namespace Server.Network
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Span2D<byte> InitializePackets(this Span2D<byte> buffer)
public static Span<byte> InitializePackets(this Span<byte> buffer, int width)
{
#if NO_LOCAL_INIT
for (var i = 0; i < buffer.Height; i++)
for (var i = 0; i < buffer.Length; i += width)
{
buffer.GetRowSpan(i)[0] = 0;
buffer[i] = 0;
}
#endif
return buffer;