chore(core): Cleans up networking leftovers from packet conversions (#387)

- [X] Removes span writing extensions
- [X] Removes span reading extensions
- [X] Cleans up OPL and uses uninitialized arrays

Bumps release version
This commit is contained in:
Kamron Batman 2021-01-05 01:31:52 -08:00 committed by GitHub
parent a278623f38
commit 30ef0761cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 392 deletions

View file

@ -173,17 +173,17 @@ namespace Server
var tileList = new List<MultiTileEntry>();
// Skip the first 4 bytes
var pos = 4;
var count = data.ReadUInt32LE(ref pos);
var reader = new SpanReader(data);
reader.Seek(4, SeekOrigin.Begin);
var count = reader.ReadUInt32LE();
for (uint i = 0; i < count; i++)
{
var itemId = data.ReadUInt16LE(ref pos);
var x = data.ReadInt16LE(ref pos);
var y = data.ReadInt16LE(ref pos);
var z = data.ReadInt16LE(ref pos);
var flagValue = data.ReadUInt16LE(ref pos);
var itemId = reader.ReadUInt16LE();
var x = reader.ReadInt16LE();
var y = reader.ReadInt16LE();
var z = reader.ReadInt16LE();
var flagValue = reader.ReadUInt16LE();
var tileFlag = flagValue switch
{
@ -192,8 +192,9 @@ namespace Server
_ => TileFlag.Background // 0
};
var clilocsCount = data.ReadUInt32LE(ref pos);
pos += (int)Math.Min(clilocsCount, int.MaxValue) * 4; // bypass binary block
var clilocsCount = reader.ReadUInt32LE();
var skip = (int)Math.Min(clilocsCount, int.MaxValue) * 4; // bypass binary block
reader.Seek(skip, SeekOrigin.Current);
tileList.Add(new MultiTileEntry(itemId, x, y, z, tileFlag));
}