Fixes for Last Moved (#194)

This commit is contained in:
Kamron Batman 2020-08-16 06:58:16 -07:00 • committed by GitHub
parent 3a081d5322
commit b476bcfd24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 155 additions and 398 deletions

View file

@ -121,8 +121,8 @@ namespace Server
private static readonly Stack<ConsoleColor> m_ConsoleColors = new Stack<ConsoleColor>();
public static Encoding UTF8 => m_UTF8 ?? (m_UTF8 = new UTF8Encoding(false, false));
public static Encoding UTF8WithEncoding => m_UTF8WithEncoding ?? (m_UTF8WithEncoding = new UTF8Encoding(true, false));
public static Encoding UTF8 => m_UTF8 ??= new UTF8Encoding(false, false);
public static Encoding UTF8WithEncoding => m_UTF8WithEncoding ??= new UTF8Encoding(true, false);
public static void Separate(StringBuilder sb, string value, string separator)
{
@ -139,6 +139,9 @@ namespace Server
str = Intern(str);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string IsNullOrDefault(this string value, string def) => value?.Length > 0 ? value : def;
public static IPAddress Intern(IPAddress ipAddress)
{
_ipAddressTable ??= new Dictionary<IPAddress, IPAddress>();
@ -835,9 +838,6 @@ namespace Server
&& p1.Y >= p2.Y - 18
&& p1.Y <= p2.Y + 18;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Coerce(int number, int min, int max) => number < min ? min : number > max ? max : number;
// 4d6+8 would be: Utility.Dice( 4, 6, 8 )
public static int Dice(uint amount, uint sides, int bonus)
{