Cleanup & Fixes for .NET 5 (#309)

- [X] Fixes several bugs
- [X] Updates more ordinal issues
- [X] Cleans up the code a bit
- [X] Turns classes static that should have been
- [X] Changes TcpServer.Instances to a HashSet

Bumps release version
This commit is contained in:
Kamron Batman 2020-11-15 10:03:50 -08:00 committed by GitHub
parent 4ad8811df2
commit 525cda5413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
266 changed files with 1348 additions and 1800 deletions

View file

@ -5,9 +5,6 @@ namespace Server
{
public class TileMatrixPatch
{
private readonly int m_LandBlocks;
private readonly int m_StaticBlocks;
private StaticTile[] m_TileBuffer = new StaticTile[128];
public TileMatrixPatch(TileMatrix matrix, int index)
@ -22,7 +19,7 @@ namespace Server
if (File.Exists(mapDataPath) && File.Exists(mapIndexPath))
{
m_LandBlocks = PatchLand(matrix, mapDataPath, mapIndexPath);
LandBlocks = PatchLand(matrix, mapDataPath, mapIndexPath);
}
var staDataPath = Core.FindDataFile($"stadif{index}.mul", false);
@ -31,33 +28,16 @@ namespace Server
if (File.Exists(staDataPath) && File.Exists(staIndexPath) && File.Exists(staLookupPath))
{
m_StaticBlocks = PatchStatics(matrix, staDataPath, staIndexPath, staLookupPath);
StaticBlocks = PatchStatics(matrix, staDataPath, staIndexPath, staLookupPath);
}
}
// TODO: Use configuration
public static bool Enabled { get; set; } = true;
public int LandBlocks
{
get
{
lock (this)
{
return m_LandBlocks;
}
}
}
public int LandBlocks { get; }
public int StaticBlocks
{
get
{
lock (this)
{
return m_StaticBlocks;
}
}
}
public int StaticBlocks { get; }
[MethodImpl(MethodImplOptions.Synchronized)]
private unsafe int PatchLand(TileMatrix matrix, string dataPath, string indexPath)