fix: Cleans up core code (#1187)
**Only one functional change** * Fixes a bug in LogFactory where `Warning` is being logged as `Information` Non-functional changes: * Updates/Fixes copyright headers * Removes namespace scopes for core files. View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
parent
0138d40bda
commit
f268d5d4e2
262 changed files with 28527 additions and 28646 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*************************************************************************
|
||||
* ModernUO *
|
||||
* Copyright 2019-2020 - ModernUO Development Team *
|
||||
* Copyright 2019-2022 - ModernUO Development Team *
|
||||
* Email: hi@modernuo.com *
|
||||
* File: Point2D.cs *
|
||||
* *
|
||||
|
|
@ -15,102 +15,101 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace Server
|
||||
namespace Server;
|
||||
|
||||
[Parsable]
|
||||
public struct Point2D
|
||||
: IPoint2D, IComparable<Point2D>, IComparable<IPoint2D>, IEquatable<object>, IEquatable<Point2D>,
|
||||
IEquatable<IPoint2D>
|
||||
{
|
||||
[Parsable]
|
||||
public struct Point2D
|
||||
: IPoint2D, IComparable<Point2D>, IComparable<IPoint2D>, IEquatable<object>, IEquatable<Point2D>,
|
||||
IEquatable<IPoint2D>
|
||||
internal int m_X;
|
||||
internal int m_Y;
|
||||
|
||||
public static readonly Point2D Zero = new(0, 0);
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public int X
|
||||
{
|
||||
internal int m_X;
|
||||
internal int m_Y;
|
||||
get => m_X;
|
||||
set => m_X = value;
|
||||
}
|
||||
|
||||
public static readonly Point2D Zero = new(0, 0);
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public int Y
|
||||
{
|
||||
get => m_Y;
|
||||
set => m_Y = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public int X
|
||||
{
|
||||
get => m_X;
|
||||
set => m_X = value;
|
||||
}
|
||||
public Point2D(int x, int y)
|
||||
{
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Counselor)]
|
||||
public int Y
|
||||
{
|
||||
get => m_Y;
|
||||
set => m_Y = value;
|
||||
}
|
||||
public Point2D(Point2D p) : this(p.X, p.Y)
|
||||
{
|
||||
}
|
||||
|
||||
public Point2D(int x, int y)
|
||||
{
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
}
|
||||
public override string ToString() => $"({m_X}, {m_Y})";
|
||||
|
||||
public Point2D(Point2D p) : this(p.X, p.Y)
|
||||
{
|
||||
}
|
||||
public static Point2D Parse(string value)
|
||||
{
|
||||
var start = value.IndexOfOrdinal('(');
|
||||
var end = value.IndexOf(',', start + 1);
|
||||
|
||||
public override string ToString() => $"({m_X}, {m_Y})";
|
||||
Utility.ToInt32(value.AsSpan(start + 1, end - (start + 1)).Trim(), out var x);
|
||||
|
||||
public static Point2D Parse(string value)
|
||||
{
|
||||
var start = value.IndexOfOrdinal('(');
|
||||
var end = value.IndexOf(',', start + 1);
|
||||
start = end;
|
||||
end = value.IndexOf(')', start + 1);
|
||||
|
||||
Utility.ToInt32(value.AsSpan(start + 1, end - (start + 1)).Trim(), out var x);
|
||||
Utility.ToInt32(value.AsSpan(start + 1, end - (start + 1)).Trim(), out var y);
|
||||
|
||||
start = end;
|
||||
end = value.IndexOf(')', start + 1);
|
||||
return new Point2D(x, y);
|
||||
}
|
||||
|
||||
Utility.ToInt32(value.AsSpan(start + 1, end - (start + 1)).Trim(), out var y);
|
||||
public bool Equals(Point2D other) => m_X == other.m_X && m_Y == other.m_Y;
|
||||
|
||||
return new Point2D(x, y);
|
||||
}
|
||||
public bool Equals(IPoint2D other) =>
|
||||
m_X == other?.X && m_Y == other.Y;
|
||||
|
||||
public bool Equals(Point2D other) => m_X == other.m_X && m_Y == other.m_Y;
|
||||
public override bool Equals(object obj) => obj is Point2D other && Equals(other);
|
||||
|
||||
public bool Equals(IPoint2D other) =>
|
||||
m_X == other?.X && m_Y == other.Y;
|
||||
public override int GetHashCode() => HashCode.Combine(m_X, m_Y);
|
||||
|
||||
public override bool Equals(object obj) => obj is Point2D other && Equals(other);
|
||||
public static bool operator ==(Point2D l, Point2D r) => l.m_X == r.m_X && l.m_Y == r.m_Y;
|
||||
|
||||
public override int GetHashCode() => HashCode.Combine(m_X, m_Y);
|
||||
public static bool operator !=(Point2D l, Point2D r) => l.m_X != r.m_X || l.m_Y != r.m_Y;
|
||||
|
||||
public static bool operator ==(Point2D l, Point2D r) => l.m_X == r.m_X && l.m_Y == r.m_Y;
|
||||
public static bool operator ==(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X == r.X && l.m_Y == r.Y;
|
||||
|
||||
public static bool operator !=(Point2D l, Point2D r) => l.m_X != r.m_X || l.m_Y != r.m_Y;
|
||||
public static bool operator !=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && (l.m_X != r.X || l.m_Y != r.Y);
|
||||
|
||||
public static bool operator ==(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X == r.X && l.m_Y == r.Y;
|
||||
public static bool operator >(Point2D l, Point2D r) => l.m_X > r.m_X && l.m_Y > r.m_Y;
|
||||
|
||||
public static bool operator !=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && (l.m_X != r.X || l.m_Y != r.Y);
|
||||
public static bool operator >(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X > r.X && l.m_Y > r.Y;
|
||||
|
||||
public static bool operator >(Point2D l, Point2D r) => l.m_X > r.m_X && l.m_Y > r.m_Y;
|
||||
public static bool operator <(Point2D l, Point2D r) => l.m_X < r.m_X && l.m_Y < r.m_Y;
|
||||
|
||||
public static bool operator >(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X > r.X && l.m_Y > r.Y;
|
||||
public static bool operator <(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X < r.X && l.m_Y < r.Y;
|
||||
|
||||
public static bool operator <(Point2D l, Point2D r) => l.m_X < r.m_X && l.m_Y < r.m_Y;
|
||||
public static bool operator >=(Point2D l, Point2D r) => l.m_X >= r.m_X && l.m_Y >= r.m_Y;
|
||||
|
||||
public static bool operator <(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X < r.X && l.m_Y < r.Y;
|
||||
public static bool operator >=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X >= r.X && l.m_Y >= r.Y;
|
||||
|
||||
public static bool operator >=(Point2D l, Point2D r) => l.m_X >= r.m_X && l.m_Y >= r.m_Y;
|
||||
public static bool operator <=(Point2D l, Point2D r) => l.m_X <= r.m_X && l.m_Y <= r.m_Y;
|
||||
|
||||
public static bool operator >=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X >= r.X && l.m_Y >= r.Y;
|
||||
public static bool operator <=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X <= r.X && l.m_Y <= r.Y;
|
||||
|
||||
public static bool operator <=(Point2D l, Point2D r) => l.m_X <= r.m_X && l.m_Y <= r.m_Y;
|
||||
public int CompareTo(Point2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.m_X);
|
||||
return xComparison != 0 ? xComparison : m_Y.CompareTo(other.m_Y);
|
||||
}
|
||||
|
||||
public static bool operator <=(Point2D l, IPoint2D r) => !ReferenceEquals(r, null) && l.m_X <= r.X && l.m_Y <= r.Y;
|
||||
|
||||
public int CompareTo(Point2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.m_X);
|
||||
return xComparison != 0 ? xComparison : m_Y.CompareTo(other.m_Y);
|
||||
}
|
||||
|
||||
public int CompareTo(IPoint2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.X);
|
||||
return xComparison != 0 ? xComparison : m_Y.CompareTo(other.Y);
|
||||
}
|
||||
public int CompareTo(IPoint2D other)
|
||||
{
|
||||
var xComparison = m_X.CompareTo(other.X);
|
||||
return xComparison != 0 ? xComparison : m_Y.CompareTo(other.Y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue