fix(core): Fixes OPL packets (#395)
- [X] Fixes an issue with OPL packets using the wrong endianness and not updating the position properly. - [X] Fixes an issue with SpanWriter not updating bytes written when it is used adhoc. - [X] Moves packet creation for OPL inside the SendInfoTo function. Bumps release version
This commit is contained in:
parent
1a593089e9
commit
5882b1ab3f
6 changed files with 17 additions and 10 deletions
|
|
@ -365,7 +365,7 @@ namespace System.Buffers
|
|||
Grow(newPosition - _buffer.Length + 1);
|
||||
}
|
||||
|
||||
return _position = newPosition;
|
||||
return Position = newPosition;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,7 @@ namespace Server
|
|||
Span<byte> opl = ObjectPropertyList.Enabled ? stackalloc byte[OutgoingEntityPackets.OPLPacketLength] : null;
|
||||
if (opl != null)
|
||||
{
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
opl.InitializePacket();
|
||||
}
|
||||
|
||||
var eable = m_Map.GetClientsInRange(m_Location, GetMaxUpdateRange());
|
||||
|
|
@ -3094,8 +3094,13 @@ namespace Server
|
|||
|
||||
public virtual int GetUpdateRange(Mobile m) => 18;
|
||||
|
||||
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, ReadOnlySpan<byte> opl = default)
|
||||
public virtual void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
{
|
||||
if (opl != null && opl[0] == 0)
|
||||
{
|
||||
OutgoingEntityPackets.CreateOPLInfo(opl, this);
|
||||
}
|
||||
|
||||
SendWorldPacketTo(ns, world);
|
||||
SendOPLPacketTo(ns, opl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Server.Network
|
||||
{
|
||||
public static class IncomingEntityPackets
|
||||
|
|
|
|||
|
|
@ -117,19 +117,19 @@ namespace Server
|
|||
AddHash(arguments.GetHashCode(StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
int strLength = Utility.Unicode.GetByteCount(arguments);
|
||||
|
||||
int strLength = arguments.Length * 2;
|
||||
int length = _position + 6 + strLength;
|
||||
while (length > _buffer.Length)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
|
||||
var writer = new SpanWriter(_buffer);
|
||||
writer.Seek(_position, SeekOrigin.Begin);
|
||||
var writer = new SpanWriter(_buffer.AsSpan(_position));
|
||||
writer.Write(number);
|
||||
writer.Write((ushort)strLength);
|
||||
writer.WriteBigUni(arguments);
|
||||
writer.WriteLittleUni(arguments);
|
||||
|
||||
_position += writer.BytesWritten;
|
||||
}
|
||||
|
||||
public void Add(int number, string format, object arg0)
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, ReadOnlySpan<byte> opl = default)
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
{
|
||||
base.SendInfoTo(ns, world, opl);
|
||||
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ namespace Server.Multis
|
|||
stateToSend.SendGeneralInfoTo(ns);
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, ReadOnlySpan<byte> opl = default)
|
||||
public override void SendInfoTo(NetState ns, ReadOnlySpan<byte> world, Span<byte> opl)
|
||||
{
|
||||
base.SendInfoTo(ns, world, opl);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue