cleanup: Fixes bugs and cleans up code (#660)
This commit is contained in:
parent
1de0b656a9
commit
679e8100f4
99 changed files with 160 additions and 346 deletions
|
|
@ -3553,8 +3553,7 @@ namespace Server
|
|||
var landTile = map.Tiles.GetLandTile(x, y);
|
||||
var landFlags = TileData.LandTable[landTile.ID & TileData.MaxLandValue].Flags;
|
||||
|
||||
int landZ = 0, landAvg = 0, landTop = 0;
|
||||
map.GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
|
||||
map.GetAverageZ(x, y, out var landZ, out var landAvg, out _);
|
||||
|
||||
if (!landTile.Ignored && (landFlags & TileFlag.Impassable) == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Server.Logging
|
||||
{
|
||||
|
|
@ -24,33 +25,43 @@ namespace Server.Logging
|
|||
public SerilogLogger(Serilog.ILogger serilogLogger) =>
|
||||
this.serilogLogger = serilogLogger;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Debug(string message, params object[] args) =>
|
||||
serilogLogger.Debug(message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Debug(Exception exception, string message, params object[] args) =>
|
||||
serilogLogger.Debug(exception, message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Information(string message, params object[] args) =>
|
||||
serilogLogger.Information(message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Information(Exception exception, string message, params object[] args) =>
|
||||
serilogLogger.Information(exception, message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Warning(string message, params object[] args) =>
|
||||
serilogLogger.Warning(message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Warning(Exception exception, string message, params object[] args) =>
|
||||
serilogLogger.Information(exception, message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Error(string message, params object[] args) =>
|
||||
serilogLogger.Error(message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Error(Exception exception, string message, params object[] args) =>
|
||||
serilogLogger.Error(exception, message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Fatal(string message, params object[] args) =>
|
||||
serilogLogger.Fatal(message, args);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Fatal(Exception exception, string message, params object[] args) =>
|
||||
serilogLogger.Fatal(exception, message, args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -435,14 +435,11 @@ namespace Server
|
|||
|
||||
public int GetAverageZ(int x, int y)
|
||||
{
|
||||
int z = 0, avg = 0, top = 0;
|
||||
|
||||
GetAverageZ(x, y, ref z, ref avg, ref top);
|
||||
|
||||
GetAverageZ(x, y, out _, out var avg, out _);
|
||||
return avg;
|
||||
}
|
||||
|
||||
public void GetAverageZ(int x, int y, ref int z, ref int avg, ref int top)
|
||||
public void GetAverageZ(int x, int y, out int z, out int avg, out int top)
|
||||
{
|
||||
var zTop = Tiles.GetLandTile(x, y).Z;
|
||||
var zLeft = Tiles.GetLandTile(x, y + 1).Z;
|
||||
|
|
@ -556,8 +553,7 @@ namespace Server
|
|||
var landTile = Tiles.GetLandTile(x, y);
|
||||
var tiles = Tiles.GetStaticTiles(x, y, true);
|
||||
|
||||
int landZ = 0, landAvg = 0, landTop = 0;
|
||||
GetAverageZ(x, y, ref landZ, ref landAvg, ref landTop);
|
||||
GetAverageZ(x, y, out _, out var landAvg, out _);
|
||||
|
||||
var items = AcquireFixItems(this, x, y);
|
||||
|
||||
|
|
@ -1010,8 +1006,7 @@ namespace Server
|
|||
{
|
||||
p = target.Location;
|
||||
|
||||
int low = 0, avg = 0, top = 0;
|
||||
GetAverageZ(p.X, p.Y, ref low, ref avg, ref top);
|
||||
GetAverageZ(p.X, p.Y, out _, out _, out var top);
|
||||
|
||||
p.Z = top + 1;
|
||||
}
|
||||
|
|
@ -1108,9 +1103,7 @@ namespace Server
|
|||
var hasSurface = false;
|
||||
|
||||
var lt = Tiles.GetLandTile(x, y);
|
||||
int lowZ = 0, avgZ = 0, topZ = 0;
|
||||
|
||||
GetAverageZ(x, y, ref lowZ, ref avgZ, ref topZ);
|
||||
GetAverageZ(x, y, out var lowZ, out var avgZ, out _);
|
||||
var landFlags = TileData.LandTable[lt.ID & TileData.MaxLandValue].Flags;
|
||||
|
||||
if ((landFlags & TileFlag.Impassable) != 0 && avgZ > z && z + height > lowZ)
|
||||
|
|
@ -1327,8 +1320,7 @@ namespace Server
|
|||
var pointTop = point.m_Z + 1;
|
||||
|
||||
var landTile = Tiles.GetLandTile(point.X, point.Y);
|
||||
int landZ = 0, landAvg = 0, landTop = 0;
|
||||
GetAverageZ(point.m_X, point.m_Y, ref landZ, ref landAvg, ref landTop);
|
||||
GetAverageZ(point.m_X, point.m_Y, out var landZ, out _, out var landTop);
|
||||
|
||||
if (landZ <= pointTop && landTop >= point.m_Z &&
|
||||
(point.m_X != end.m_X || point.m_Y != end.m_Y || landZ > endTop || landTop < end.m_Z) &&
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server
|
|||
{
|
||||
private static readonly INativeReader m_NativeReader;
|
||||
|
||||
static NativeReader() => m_NativeReader = Core.Unix ? (INativeReader)new NativeReaderUnix() : new NativeReaderWin32();
|
||||
static NativeReader() => m_NativeReader = Core.Unix ? new NativeReaderUnix() : new NativeReaderWin32();
|
||||
|
||||
public static unsafe int Read(FileStream source, void* buffer, int length) =>
|
||||
m_NativeReader.Read(source, buffer, length);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ namespace Server
|
|||
public int Version { get; }
|
||||
public bool EncodedVersion { get; }
|
||||
|
||||
public SerializableAttribute(int version, bool encodedVersion = true) => Version = version;
|
||||
public SerializableAttribute(int version, bool encodedVersion = true)
|
||||
{
|
||||
Version = version;
|
||||
EncodedVersion = encodedVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,9 +252,6 @@ namespace Server.Targeting
|
|||
|
||||
private class TimeoutTimer : Timer
|
||||
{
|
||||
private static readonly TimeSpan ThirtySeconds = TimeSpan.FromSeconds(30.0);
|
||||
private static readonly TimeSpan TenSeconds = TimeSpan.FromSeconds(10.0);
|
||||
private static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1.0);
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly Target m_Target;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue